記錄: 2017/3

0

Path Sum III

Path Sum IIIYou are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need to start or end at the root or a leaf,

0

Number of Segments in a String

Number of Segments in a StringCount the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters. Please note that the string does not contain an

0

Add Strings

Add StringsGiven two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: The length of both num1 and num2 is < 5100. Both num1 and num2 contains only

0

Third Maximum Number

Third Maximum NumberGiven a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). Example 1

0

Fizz Buzz

Fizz BuzzWrite 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 “

0

Longest Palindrome

Longest PalindromeGiven a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensitive, for example

0

Convert a Number to Hexadecimal

Convert a Number to HexadecimalGiven an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: All letters in hexadecimal (a-f) must b

0

Sum of Left Leaves

Sum of Left LeavesFind the sum of all left leaves in a given binary tree. For Example:1234567 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 resp

0

Binary Watch

Binary WatchA binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents a zero or one, with the least signifi