当前位置:网站首页>Byte daily practice (OC)
Byte daily practice (OC)
2022-04-21 22:07:00 【veggie_ a_ h】
Byte daily practice side ( has OC)
4.13. evening 7 spot (1 One and a half hours )
Most of their companies are react frame + Self encapsulation hooks
- Self introduction. + Project introduction
- Ask how the micro front-end application is related to the parent application and the core implementation of the micro front-end
- Several ways to judge the type
- Handwriting instanceof The implementation of the
// Iterative implementation
function instanceOf(obj,constructor){
// take constructor The prototype of the
let prototype = constructor.prototype;
// take obj The prototype of the
obj = obj.__proto__;
while(true){
if(obj === prototype)
return true;
obj = obj.__proto__;
if(obj === null)
return false;
}
}
- typeof The shortcomings of
- Deep clone shallow clone
Deep copy implementation :
Method 1: Use the blending method :
var obj = {
a:1,b:2}
var newObj = Object.assign({
},obj)
Method 2: Using recursion
-
Box model , Use scenarios
-
for in and for of The difference between
-
position Properties of
-
ts The difference between enumeration type and object
-
vue and react The difference between
-
Make a fan
... Just remember so much
10. Byte daily practice two sides
4.14. Afternoon 4 spot (1 Hours )
Self introduction. + Project introduction
- In the project, when logging in , How does the server know which user logged in (token)
- token What is it?
- session What is it? , and cookie、sessionStorage The difference between
- CDN What is it?
- Browser cache
- tcp and udp The difference between
- http and https The difference between
-
// Note that the chess board is 7 * 7, Then each day of chess jump
// let count = 0
function solution(x0, y0, xn, yn, n) {
// Recursive export
if (n == 0) {
if (x0 == xn && y0 == yn) {
// count++
return 1
}
return 0
}
let arr = getNextSteps(x0, y0)
let sum = 0
console.log(arr);
for (let i = 0; i < arr.length; i++) {
sum += solution(arr[i][0], arr[i][1], xn, yn, n - 1)
}
return sum
}
let c = solution(0, 0, 5, 6, 5)
// console.log(count);
console.log(c);
// Used to judge its next jump , In the middle, there are 8 There are two jumping situations
function getNextSteps(x, y) {
let arr = []
// Jump to the first quadrant
if (x <= 4 && y >= 1) {
arr.push([x + 2, y - 1])
}
if (x <= 5 && y >= 2) {
arr.push([x + 1, y - 2])
}
// Jump to the second quadrant
if (x >= 2 && y >= 1) {
arr.push([x - 2, y - 1])
}
if (x >= 1 && y >= 2) {
arr.push([x - 1, y - 2])
}
// Jump to the third quadrant
if (x >= 2 && y <= 5) {
arr.push([x - 2, y + 1])
}
if (x >= 1 && y <= 4) {
arr.push([x - 1, y + 2])
}
// Jump to the fourth quadrant
if (x <= 4 && y <= 5) {
arr.push([x + 2, y + 1])
}
if (x <= 5 && y <= 4) {
arr.push([x + 1, y + 2])
}
return arr
}
// let arr = getNextSteps(0, 0)
// console.log(arr);
- Write about the dfs Find the sum of all nodes of the tree
class Tree {
constructor(val, left, right) {
this.left = left == undefined ? null : left
this.right = right == undefined ? null : right
this.val = val == undefined ? 0 : val
}
}
// Subsequent traversal to find the sum of nodes
function treeNode(root) {
if (!root) {
return 0
}
// console.log(root.val);
let left = treeNode(root.left) // Go all the way to the leaf node of the left subtree , Because the leaf node has no left node , That is, its left node is null It's over , So it's going back to 0
let right = treeNode(root.right) // return 0
let sum = left + right + root.val // Get the sum of the tree with the current node as the root
console.log(sum);
return sum
}
let tree = new Tree(1, new Tree(2, new Tree(4), new Tree(5)), new Tree(3))
console.log(treeNode(tree));
11. Byte daily practice on three sides
Didn't ask what . Mainly write code .
-
Re write down the horse vaulting that failed to pass the code question on the second side 、 There are follow-up traversal and sequence traversal to find the sum of all nodes .
-
Use binary search to find the inflection point index of an array that increases first and then decreases .[1, 2, 3, 2, 1] => 2
版权声明
本文为[veggie_ a_ h]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204212205098760.html
边栏推荐
猜你喜欢

Leetcode0785. 判断二分图(medium,二分图,DFS)

How to connect ODBC database with PHP?

php如何给数组增加一个数组元素

【VSCode】调试器debugger详细使用手册

Document de conception de l'architecture du système de gestion des étudiants externalisé

JS to realize automatic scrolling of announcements

WPF data-driven method for modifying binding

Intensive reading of Fanfan's anti attack paper (II) CVPR 2021 yuan learning training simulator for ultra efficient black box attack (Tsinghua)

Building local canal middleware for data migration -- Inspiration from cache breakdown

Interview must brush algorithm top101 knapsack nine lectures Top13
随机推荐
Software life cycle
IDEA通过Jedis操作Linux上的Redis;Failed to connect to any host resolved for DNS name问题
es6如何求两个数组的交集
what? Your company has not set the JVM initial and maximum heap memory size to the same value?
期货在网上直接开户是否安全?
ROS robot from starting point to end point (IV) reproduction of blue bridge cloud practice
Record a pit in the split3 Library (table name and field definition cannot use placeholders?)
Online CSV to yaml tool
Domestic API management artifact eolink, I love it
Restcloud ETL out of the box - permanently free
Oracle cascade delete table (not subject to foreign key constraints)
2022年重庆最新建筑八大员(土建)模拟题库及答案
WPF data-driven method for modifying binding
unity3d导入倾斜模型等
[best practice] patrol inspection item: local disk type inspection of cloud server (CVM) instance
INT 102_TTL 09
Building local canal middleware for data migration -- Inspiration from cache breakdown
【WebGIS】WebGIS、桌面GIS、移动GIS、三维GIS的简介
GD32F303学习笔记(1)——搭建环境、编译烧写
echart 写一个大屏展示圆边渐变柱状图