
leetcode
文章平均质量分 52
Claire_Bear7
这个作者很懒,什么都没留下…
展开
-
LeetCode 之 Divide Two Integers
LeetCode 之 Divide Two Integers Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT.原创 2015-06-17 00:07:08 · 546 阅读 · 0 评论 -
Leetcode 之 Restore IP Addresses
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example: Given “25525511135”,return [“255.255.11.135”, “255.255.111.35”]. (Order does not原创 2015-07-22 00:30:29 · 572 阅读 · 0 评论 -
Leetcode 之 Subsets
Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For example, If nums原创 2015-08-13 23:20:51 · 723 阅读 · 0 评论 -
Leetcode 之 Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray原创 2015-07-21 00:01:16 · 519 阅读 · 0 评论 -
Leetcode 之 Candy
There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least one candy.原创 2015-07-14 16:19:06 · 472 阅读 · 0 评论 -
Leetcode 之 Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at any原创 2015-07-05 23:46:54 · 565 阅读 · 0 评论 -
Leetcode 之 Unique Binary Search Trees
Given n, how many structurally unique BST’s (binary search trees) that store values 1…n?For example, Given n = 3, there are a total of 5 unique BST’s.原创 2015-07-04 23:19:12 · 419 阅读 · 0 评论 -
Leetcode 之 Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1,2,1,−5,4], the contiguous subarray [4,−1,2,1] has the原创 2015-07-26 00:45:36 · 555 阅读 · 0 评论 -
Leetcode 之 Word Break1 和 Word Break2
Word Beark1 Given 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, given s = “leetcode”, dict原创 2015-07-03 12:32:10 · 1082 阅读 · 0 评论 -
Leetcode 之 Unique Paths
A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the botto原创 2015-07-04 00:03:56 · 446 阅读 · 0 评论 -
Leetcode 之 Two Sum I
Given 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 target, where in原创 2015-07-02 14:45:18 · 494 阅读 · 0 评论 -
Leetcode 之 Best Time to Buy and Sell StockI,II
Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), desi原创 2015-07-07 01:33:03 · 521 阅读 · 0 评论 -
Leetcode 之 Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you are原创 2015-07-08 23:57:36 · 518 阅读 · 0 评论 -
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 neig原创 2015-06-20 11:29:33 · 666 阅读 · 0 评论 -
Leetcode 之 Find Minimum in Rotated Sorted Array
Suppose a sorted array is rotated at some pivot unknown to you beforehand (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. You may assume no duplicate exists in the array.原创 2015-06-22 00:45:28 · 557 阅读 · 0 评论 -
Leetcode 之 Remove Duplicates from Sorted Array II
Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first five elemen原创 2015-06-17 22:06:48 · 562 阅读 · 0 评论 -
LeetCode之Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with cons原创 2015-06-17 20:46:37 · 518 阅读 · 0 评论 -
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 hasN原创 2015-08-02 23:23:26 · 706 阅读 · 0 评论