摘要:
Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24.publi... 阅读全文
posted @ 2017-01-10 23:04
xiejunzhao
阅读(159)
评论(0)
推荐(0)
摘要:
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, ... 阅读全文
posted @ 2017-01-10 23:03
xiejunzhao
阅读(151)
评论(0)
推荐(0)
摘要:
Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1.Example:Input: [1,2,3] Output: ... 阅读全文
posted @ 2017-01-10 23:03
xiejunzhao
阅读(98)
评论(0)
推荐(0)
摘要:
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1, 0, 3, 12], after calling your func... 阅读全文
posted @ 2017-01-10 23:01
xiejunzhao
阅读(303)
评论(0)
推荐(0)
摘要:
Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra me... 阅读全文
posted @ 2017-01-10 23:00
xiejunzhao
阅读(250)
评论(0)
推荐(0)
摘要:
Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was added in... 阅读全文
posted @ 2017-01-10 23:00
xiejunzhao
阅读(150)
评论(0)
推荐(0)
摘要:
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a coo... 阅读全文
posted @ 2017-01-10 23:00
xiejunzhao
阅读(179)
评论(0)
推荐(0)
摘要:
求二叉树的最大深度using System;using System.Collections.Generic;using System.Linq;using System.Text;using Algorithm;namespace Solution { public class Solution1 { public int MaxDepth(TreeNode root) { if (roo... 阅读全文
posted @ 2017-01-10 23:00
xiejunzhao
阅读(121)
评论(0)
推荐(0)
摘要:
Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For... 阅读全文
posted @ 2017-01-10 22:59
xiejunzhao
阅读(167)
评论(0)
推荐(0)
摘要:
Write a function that takes a string as input and returns the string reversed.Example: Given s = "hello", return "olleh". /** * @param {string} s * @return {string} */var reverseString = function (s) ... 阅读全文
posted @ 2017-01-10 22:59
xiejunzhao
阅读(180)
评论(0)
推荐(0)

浙公网安备 33010602011771号