12 2019 档案

[Leetcode] 5279. Subtract the Product and Sum of Digits of an Integer
摘要:class Solution { public int subtractProductAndSum(int n) { int productResult = 1; int sumResult = 0; do { int currentval = n % 10; productResult *= currentval; sumResult += currentval; n /= 10; }while 阅读全文

posted @ 2019-12-08 11:42 seako 阅读(176) 评论(0) 推荐(0)

[Leetcode] 104. Maximum Depth of Binary Tree
摘要:1 int depth = 0; 2 int currentMaxDepth = 0; 3 public int maxDepth(TreeNode root) { 4 if(root == null){ 5 return 0; 6 } 7 8 int leftDepth = 1; 9 int rightDepth = 1; 10 11 leftDepth += maxDepth(root.lef 阅读全文

posted @ 2019-12-08 11:38 seako 阅读(305) 评论(0) 推荐(0)