- 博客(15)
- 资源 (1)
- 收藏
- 关注
原创 LeetCode 22. Generate Parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())", "(
2017-02-24 19:06:10 444
原创 LeetCode 461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance. Note: 0≤x,y<231.0 ≤ x, y
2017-02-22 22:52:20 348
原创 LeetCode 476. Number Complement
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note: The given integer is guaranteed to fit within the range of a 32-b
2017-02-22 22:49:33 330
原创 LeetCode 520. Detect Capital
Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters in this word
2017-02-21 15:23:56 398
原创 LeetCode 20. Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all valid but "
2017-02-21 11:06:05 270
原创 LeetCode 70. 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-02-20 11:33:41 383
原创 LeetCode 66. 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-02-20 11:31:50 576
原创 LeetCode 58. 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-02-20 11:30:11 198
原创 LeetCode 35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Here
2017-02-20 11:28:34 205
原创 LeetCode 9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.程序代码:bool isPalindrome(int x) { if(x<0) return false; else if(x<10) return true; else {
2017-02-20 11:27:22 209
原创 LeetCode 8. String to Integer (atoi)
Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.N
2017-02-20 11:25:22 229
原创 LeetCode 7. Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Note: The input is assumed to be a 32-bit signed integer. Your function should return 0 when the reversed inte
2017-02-20 11:23:56 224
原创 LeetCode 3. Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", with the le
2017-02-20 11:22:03 242
原创 LeetCode 2. Add Two Numbers
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it
2017-02-20 11:20:25 277
原创 LeetCode 1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same e
2017-02-20 11:18:41 266
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人