LeetCode javascript 答案+解析
文章平均质量分 77
M_ye
这个作者很懒,什么都没留下…
展开
-
LeetCode 806.Number of Lines To Write String JavaScript 答案+解析
先放答案:var numberOfLines = function(widths, S) { var sum = 0 , con = 1; for(var i = 0 ; i < S.length ; i++){ var t = widths[S[i].charCodeAt(0) - 97]; if(sum + t > 100 ) co...原创 2018-10-21 19:27:47 · 146 阅读 · 0 评论 -
LeetCode 111.Minimum Depth of Binary Tree/ c++ & java & JavaScript
问题描述:Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.找二叉树的最小深度java版本答案:/** * Defin...原创 2019-07-02 21:58:29 · 132 阅读 · 0 评论 -
LeetCode 150. evaluate-reverse-polish-notation / java
问题描述:Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "...原创 2019-07-02 22:58:47 · 172 阅读 · 0 评论