
leetcode
燕凌姣
以梦为马 不负韶华
展开
-
leetcode 151 Two Sum
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, whe原创 2014-07-06 21:06:24 · 857 阅读 · 1 评论 -
leetcode 74 Subsets
Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For exa原创 2014-07-09 15:34:32 · 728 阅读 · 0 评论 -
leetcode 46 Permutations
#include#include#includeusing namespace std;void perm(int start,int end,vector in,vector > &res){ if(start==end) { res.push_back(in); return ;原创 2014-07-09 11:26:41 · 696 阅读 · 0 评论 -
leetcode 10 Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Follow up:Can you solve it without using extra space?原创 2014-07-10 16:39:47 · 696 阅读 · 0 评论 -
leetcode 75 Combinations
#include#include#includeusing namespace std;void com(int depth,int n,int k,vector v,vector > &res){ if(v.size()==k) { res.push_back(v); return ;原创 2014-07-09 15:06:49 · 786 阅读 · 0 评论 -
leetcode 66 Plus One
#include#include#includeusing namespace std;vector plusOne(vector &digits){ int len=digits.size(); vector res(digits); int carrybit=1,i; for(i=len-1;i>=0;i--)原创 2014-07-09 21:15:28 · 658 阅读 · 0 评论 -
leetcode 11 Linked List Cycle
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?原创 2014-07-10 16:50:26 · 707 阅读 · 0 评论 -
leetcode 17 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 on原创 2014-07-10 15:42:07 · 684 阅读 · 0 评论 -
leetcode 149 Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo原创 2014-07-07 22:01:15 · 643 阅读 · 0 评论 -
leetcode 127 Word Ladder
Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediate word m原创 2014-07-07 16:20:16 · 1090 阅读 · 0 评论 -
leetcode 69 Sqrt(x)
int sqrt(int x){return std::sqrt(x);}原创 2014-07-07 19:54:50 · 861 阅读 · 0 评论 -
leetcode 150 Median of Two Sorted Arrays
There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).原创 2014-07-07 11:06:19 · 863 阅读 · 0 评论 -
leetcode 15 Single Number II
Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without u原创 2014-07-10 15:02:32 · 783 阅读 · 0 评论