
leetcode
文章平均质量分 82
贪睡的萝卜
这个作者很懒,什么都没留下…
展开
-
Valid Number
QuestionValidate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement t原创 2015-07-13 00:16:01 · 478 阅读 · 0 评论 -
Valid Sudoku
QuestionDetermine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character '.'.A par原创 2015-07-13 17:43:52 · 512 阅读 · 0 评论 -
Two Sum
QuestionGiven an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the原创 2015-07-13 22:32:48 · 548 阅读 · 0 评论 -
Merge Two Sorted Lists
QuestionMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.My Solution/** * Definition for singly-l原创 2015-07-14 22:28:47 · 465 阅读 · 0 评论 -
Decode Ways
QuestionA message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determin原创 2015-07-15 11:20:41 · 670 阅读 · 0 评论 -
Sqrt(x)
QuestionImplement int sqrt(int x).Compute and return the square root of x.My Solutionclass Solution {public: int mySqrt(int x) { /** * binary search a from [0, x], where a^2 = x.原创 2015-08-01 20:58:21 · 2951 阅读 · 0 评论 -
Word Break II
QuestionGiven a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example原创 2015-09-04 23:12:17 · 523 阅读 · 0 评论 -
Word Break
QuestionGiven a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",原创 2015-09-04 22:34:56 · 455 阅读 · 0 评论 -
Kth Smallest Element in a BST
QuestionGiven a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Follow up原创 2015-09-04 21:30:38 · 395 阅读 · 0 评论