- 博客(18)
- 资源 (2)
- 收藏
- 关注
原创 LeetCode42. Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], ret
2017-04-22 13:33:58 358
原创 LeetCode34. Search for a Range
Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the target is
2017-04-22 11:18:46 261
原创 LeetCOde33. Search in Rotated Sorted Array
Suppose an array sorted in ascending order 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).You are given a target value to search. If found in the ar
2017-04-22 10:43:34 288
原创 LeetCode31. Next Permutation
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible orde
2017-04-21 21:04:01 322
原创 LeetCode25. Reverse Nodes in k-Group
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the number of nod
2017-04-21 11:27:36 281
原创 LeetCode24. Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example, Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. You may no
2017-04-21 09:28:12 343
原创 LeetCOde19. Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked list be
2017-04-20 20:39:33 259
原创 LeetCode18. 4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The solution set mu
2017-04-20 19:54:14 389
原创 LeetCode17. Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below. Input:Digit string “23”
2017-04-17 20:45:46 417
原创 LeetCode16. 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly
2017-04-17 10:50:56 323
原创 LeetCode15. 3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not contain duplic
2017-04-17 09:16:17 389
原创 LeetCode88. Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additional
2017-04-10 14:24:26 249
原创 LeetCode83. Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3./** * Definition for singly-lin
2017-04-09 10:27:55 226
原创 LeetCode70. Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive inte
2017-04-09 09:44:07 233
原创 LeetCode67. Add Binary
Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.#include<string>#include<cstdlib>#include<iostream>using namespace std;class Solution
2017-04-06 21:19:33 334
原创 LeetCode66. Plus One
Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The digits are st
2017-04-06 21:12:34 295
原创 LeetCode66. Plus One
Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.You may assume the integer do not contain any leading zero, except the number 0 itself.The digits are st
2017-04-06 19:50:45 242
原创 LeetCode58. Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defined as
2017-04-06 18:49:12 253
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人