该文被密码保护。 阅读全文
posted @ 2020-04-23 18:24 Bruce_Grace 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 思路:动态规划DP 递推公式 DP[i] = max( DP[i-1], A[i] ); // input [-2,1,3,-1,-6] // output: [1,3] 4 function maxSum(arr = []) { let tempSum = 0; let maxSum = 0; f 阅读全文
posted @ 2020-04-19 14:36 Bruce_Grace 阅读(1369) 评论(0) 推荐(0) 编辑
摘要: 以管理员方式运行CMD,在命令符号符窗口输入以下内容slmgr/ipk NPPR9-FWDCX-D2C8J-H872K-2YT43slmgr/skms kms.03k.orgslmgr/ato 阅读全文
posted @ 2020-04-01 18:24 Bruce_Grace 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 1.投机取巧版 1 var counts=1; 2 async function aa(arg){ 3 return arg; 4 } 5 aa(counts).then((res)=>{ 6 setTimeout(function(){ 7 console.log(res) 8 setTimeou 阅读全文
posted @ 2020-03-29 22:58 Bruce_Grace 阅读(1571) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-02-20 13:47 Bruce_Grace 阅读(0) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2020-02-20 13:30 Bruce_Grace 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 翻转一棵二叉树。 示例: 输入: 4 / \ 2 7 / \ / \ 1 3 6 9 输出: 4 / \ 7 2 / \ / \ 9 6 3 1 1 var invertTree = function (root) { 2 if (root !== null) { 3 var temp = root 阅读全文
posted @ 2019-12-15 02:25 Bruce_Grace 阅读(676) 评论(0) 推荐(0) 编辑
摘要: 字节三面的一道面试题,判断是否是相同二叉树 1 var isSameTree = function (p, q) { 2 if (p null && q null) return true; 3 if (p null && q !== null) return false; 4 if (p !== 阅读全文
posted @ 2019-12-15 02:04 Bruce_Grace 阅读(496) 评论(0) 推荐(0) 编辑
摘要: 1 function deepEqual(x, y) { 2 if (x y) { 3 return true; 4 } else if ((typeof x == "object" && x != null) && (typeof y == "object" && y != null)) { 5 阅读全文
posted @ 2019-12-15 01:47 Bruce_Grace 阅读(824) 评论(0) 推荐(0) 编辑
摘要: 方法多多,第一种方法是我在字节面试的时候,要我现场写出来的,记忆深刻 Method 1:array.reduce实现 1 function flatten(arr = []) { 2 return arr.reduce((a, b) => { 3 if (Array.isArray(b)) { 4 阅读全文
posted @ 2019-12-07 16:50 Bruce_Grace 阅读(1605) 评论(0) 推荐(0) 编辑