每周完成一个ARTS(Algorithm,Review,Tips,Sha):至少做一道leetcode算法题,阅读并点评至少一篇英文技术文章,学习至少一个技术技巧,分享一篇有观点和思考的技术文章.
Algorithm
给定一个二叉树,找出其最大深度。二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。说明:叶子节点是指没有子节点的节点。示例:给定二叉树[3,9,20,null,null,15,7],3/\/\返回它的最大深度3。/***Definitionforabinarytenode.*publicclassTeNode{*intval;*TeNodeleft;*TeNoderight;*TeNode(intx){val=x;}*}*/DFS递归classSolution{publicintmaxDepth(TeNoderoot){if(root==null)turn0;intleft=maxDepth(root.left);intright=maxDepth(root.right);turn1+Math.max(left,right);}}
Review
文章谈论了刻意练习的重要性。
Thekeyisdeliberativepractice:notjustdoingitagainandagain,butchallengingyourselfwithataskthatisjustbeyondyourcurntability,tryingit,analyzingyourperformancewhileandafterdoingit,andcorctinganymistakes.Thenpeat.Andpeatagain.
转载请注明:http://www.quwenlai.com/zexs/17679.html