上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 54 下一页
摘要: Preorder: 因为是preorder traversal, 我们需要先print root,然后左节点,最后右节点,而且root左边子树一定比右边子树先print出来,所以,我们可以先把当前root的右节点压栈,然后把root的左节点压栈,这样每次从栈里取的时候,可以保证左边节点的root先取 阅读全文
posted @ 2016-08-06 02:47 北叶青藤 阅读(338) 评论(0) 推荐(0)
摘要: Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You shou 阅读全文
posted @ 2016-08-06 01:47 北叶青藤 阅读(190) 评论(0) 推荐(0)
摘要: Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true Note: It is intended for the 阅读全文
posted @ 2016-08-05 23:11 北叶青藤 阅读(264) 评论(0) 推荐(0)
摘要: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font 阅读全文
posted @ 2016-08-05 11:49 北叶青藤 阅读(239) 评论(0) 推荐(0)
摘要: H-Index I Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. 阅读全文
posted @ 2016-08-05 11:06 北叶青藤 阅读(199) 评论(0) 推荐(0)
摘要: Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can f 阅读全文
posted @ 2016-08-05 08:11 北叶青藤 阅读(130) 评论(0) 推荐(0)
摘要: Implement an iterator to flatten a 2d vector. For example, Given 2d vector = By calling next repeatedly until hasNext returns false, the order of elem 阅读全文
posted @ 2016-08-05 04:04 北叶青藤 阅读(176) 评论(0) 推荐(0)
摘要: Factor Combinations Problem: Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an in 阅读全文
posted @ 2016-08-05 03:25 北叶青藤 阅读(214) 评论(0) 推荐(0)
摘要: Verify Preorder Sequence in Binary Search Tree \Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary se 阅读全文
posted @ 2016-08-05 01:27 北叶青藤 阅读(608) 评论(0) 推荐(0)
摘要: A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the h 阅读全文
posted @ 2016-08-05 00:34 北叶青藤 阅读(262) 评论(0) 推荐(0)
上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 54 下一页