- 博客(42)
- 资源 (23)
- 收藏
- 关注
原创 6. ZigZag Conversion
6. ZigZag ConversionThe string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H
2016-05-31 21:52:43 443
原创 303. Range Sum Query - Immutable
303. Range Sum Query - ImmutableGiven an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Example:Given nums = [-2, 0, 3, -5, 2, -1]sumRange(0, 2) -> 1sumRan
2016-05-31 20:55:46 695
原创 204. Count Primes
204. Count PrimesDescription:Count the number of prime numbers less than a non-negative number, n. Analysis: 大家基本都会使用这个方法啦:https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes 下面程序中vector的int类型改为bo
2016-05-31 19:55:51 576
原创 28. Implement strStr()
28. Implement strStr()Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Analysis: 字符串子串匹配问题,一般就是简单低效的朴素模式匹配算法和高效的KMP方法。 由于
2016-05-31 18:27:54 669
原创 67. Add Binary
67. Add BinaryGiven two binary strings, return their sum (also a binary string).For example, a = "11" b = "1" Return "100". Analysis: 相当于自己写一个加法运算,主要是处理好进位与当前位之间的关系。还有注意空字符串。 本题跟66. Plus One 比较类
2016-05-31 10:04:51 771
原创 14. Longest Common Prefix
14. Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.Analysis: 常规题,要细心。 单元测试: 空数组:{} 数组中出现空字符串:{"a" "" "b"} 数组中只有一个字符串。{"a"}Source Code(C
2016-05-29 15:55:14 434
原创 7. Reverse Integer
7. Reverse IntegerExample1: x = 123, return 321 Example2: x = -123, return -321Have you thought about this? Here are some good questions to ask before coding. Bonus points for you if you have already
2016-05-28 14:31:19 503
原创 190. Reverse Bits
190. Reverse BitsReverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary
2016-05-27 20:24:29 427
原创 38. Count and Say
38. Count and SayThe count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is read
2016-05-27 19:21:35 379
原创 58. Length of Last Word
58. Length of Last WordGiven 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.Not
2016-05-27 17:34:21 347
原创 290. Word Pattern
290. Word PatternGiven a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word i
2016-05-27 15:59:22 425
原创 20. Valid Parentheses
20. Valid ParenthesesGiven a string containing just the characters'(', ')','{', '}','['and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" ar
2016-05-27 12:57:18 493
原创 299. Bulls and Cows
299. Bulls and CowsYou are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you
2016-05-27 11:23:57 542
原创 205. Isomorphic Strings
205. Isomorphic StringsGiven two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be repl
2016-05-26 22:18:59 531
原创 223. Rectangle Area
223. Rectangle AreaFind the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure. Assume that
2016-05-26 19:17:22 687
原创 88. Merge Sorted Array
88. Merge Sorted ArrayGiven 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 +
2016-05-26 15:10:01 353
原创 219. Contains Duplicate II
219. Contains Duplicate IIGiven an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and
2016-05-26 11:07:39 444
原创 36. Valid Sudoku
Determine 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 partially filled sudoku which
2016-05-25 13:02:32 449
原创 9. Palindrome Number
9. Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.Some hints: Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer
2016-05-24 10:20:07 493
原创 119. Pascal's Triangle II
119. Pascal’s Triangle IIGiven an index k, return the kth row of the Pascal’s triangle.For example, given k = 3, Return [1,3,3,1]. Analysis: 118. Pascal’s Triangle 的进阶。本来想用定理“第n行的第k個數字為組合數C{n}^{k}
2016-05-23 20:24:29 411
原创 172. Factorial Trailing Zeroes
172. Factorial Trailing ZeroesGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.Analysis: 参考:http://bookshadow.com/weblog/201
2016-05-23 10:13:35 350
原创 118. Pascal's Triangle
118. Pascal’s TriangleGiven numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]Analysis: 高中时
2016-05-22 12:23:02 479
原创 342. Power of Four
342. Power of FourGiven an integer (signed 32 bits), write a function to check whether it is a power of 4.Example: Given num = 16, return true. Given num = 5, return false.Follow up: Could you solve i
2016-05-22 11:37:06 495
原创 66. Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list. Analysis: 理解题意:用一个数字构成的数组
2016-05-22 11:13:25 430
原创 27. Remove Element
27. Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constan
2016-05-22 10:00:38 401
原创 345. Reverse Vowels of a String
345. Reverse Vowels of a StringWrite a function that takes a string as input and reverse only the vowels of a string.Example 1: Given s = “hello”, return “holle”.Example 2: Given s = “leetcode”, retu
2016-05-22 09:26:04 419
原创 121. Best Time to Buy and Sell Stock
121. Best Time to Buy and Sell StockSay 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 an
2016-05-22 09:01:25 475
原创 202. Happy Number
202. Happy NumberWrite an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of
2016-05-22 00:10:50 561
原创 263. Ugly Number
263. Ugly NumberWrite a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not
2016-05-21 23:39:16 565
原创 70. Climbing Stairs
70. Climbing StairsYou 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?Link: https://le
2016-05-21 17:41:56 460
原创 231. Power of Two
231. Power of TwoGiven an integer, write a function to determine if it is a power of two. Link: https://leetcode.com/problems/power-of-two/ Analysis: 方法还是有几种的,比如:除2法,log法,列举法等等。跟326. Power of Thr
2016-05-19 20:06:44 484
原创 326. Power of Three
326. Power of ThreeDescription: Given an integer, write a function to determine if it is a power of three. Follow up: Could you do it without using any loop / recursion? Link: https://leetcode.c
2016-05-19 18:54:41 475
原创 191. Number of 1 Bits
191. Number of 1 BitsDescription: Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight). Example: For example, the 32-bit inte
2016-05-18 22:15:57 427
原创 13. Roman to Integer
13. Roman to IntegerDescription: Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999. Link: https://leetcode.com/problems/roman-to-integer/ A
2016-05-17 17:44:37 427
原创 169. Majority Element
169. Majority ElementDescription: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-em
2016-05-17 15:52:44 381
原创 168. Excel Sheet Column Title
168. Excel Sheet Column TitleDescription: Given a positive integer, return its corresponding column title as appear in an Excel sheet. Example: 1 -> A 2 -> B 3 -> C ...26 -> Z27 -> AA28 -> AB
2016-05-15 19:02:26 617
原创 171. Excel Sheet Column Number
171. Excel Sheet Column NumberDescription: Given a column title as appear in an Excel sheet, return its corresponding column number.Example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -
2016-05-14 22:05:11 659
原创 242. Valid Anagram
242. Valid AnagramDescription: Given two strings s and t, write a function to determine if t is an anagram of s. note: You may assume the string contains only lowercase alphabets. Example: For
2016-05-14 14:35:30 797
原创 283. Move Zeroes
283. Move ZeroesDescription: Given an array nums, write a function to move all 0 ‘s to the end of it while maintaining the relative order of the non-zero elements. note: 1. You must do this in-plac
2016-05-13 14:46:09 778
原创 258. Add Digits
258. Add DigitsDescription: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Could you do it without any loop/recursion in O(1) runtime? Example:
2016-05-13 14:13:49 657
Machine_Learning_Yearning_V0.5_01
2016-12-08
CS231n课程知识点汇总(lecture1-5).docx
2016-11-18
OpenCV3编程入门_毛星云编著
2015-12-05
基于Activex控件的C++、C#混合编程
2015-11-07
扫雷程序源码
2015-06-12
VS2010 VC++创建.rc资源文件(二)
2015-06-07
VS2010 VC++创建.rc资源文件(一)
2015-06-07
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人