- 博客(16)
- 收藏
- 关注
原创 [Leetcode]Word Search
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically n
2015-03-25 15:17:10 224
原创 [Leetcode] Binary Tree Upside Down
Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it upside down and turn it into a tree where the origin
2015-03-17 19:41:32 257
原创 [Leetocde]Missing Ranges
Given a sorted integer array where the range of elements are [lower, upper] inclusive, return its missing ranges. For example, given [0, 1, 3, 50, 75], lower = 0 and upper = 99, return ["2", "4->49",
2015-03-17 16:51:06 241
原创 [Leetcode]Find Peak Element
A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its index. The array may contain multiple peaks, in that
2015-03-17 14:13:03 288
原创 [Leetcode]Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers
2015-03-16 10:43:13 203
原创 [Leetcode]Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. class Solution { public: //refer to http://en.wikipedia.org/wiki/Tra
2015-03-15 17:41:46 251
原创 [Leetcode]Excel Sheet Column Number
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... Z
2015-03-15 17:37:19 239
原创 [Leetcode]Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the next smallest number in the BST. Note: next() and
2015-03-15 17:24:40 229
原创 [Leetcode]Largest Number
Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330. Note: The result may be very
2015-03-15 14:03:27 259
原创 [Leetcode]Reverse Words in a String II
Question: Given an input string, reverse the string word by word. A word is defined as a sequence of non-space characters. The input string does not contain leading or trailing spaces and the words a
2015-03-15 11:50:54 361
原创 [Leetcode]Repeated DNA Sequences
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA. Write
2015-03-15 11:38:45 259
原创 [LeetCode] Read N Characters Given Read4
The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the f
2015-03-13 12:55:50 335
原创 [Leetcode]Compare Version Numbers
Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0. You may assume that the version strings are non-empty and cont
2015-03-13 12:50:35 227
原创 [Leetcode]Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB 基本思想:1-26 对
2015-03-13 10:25:32 290
原创 [Leetcode]Majority Element
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element alw
2015-03-12 20:38:48 261
原创 [Leetcode] Two Sum III - Data structure design
Two Sum III - Data structure design Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure. find - Fin
2015-03-12 19:43:21 516
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人