- 博客(14)
- 收藏
- 关注
原创 Longest Substring Without Repeating Characters
LeetCode原题:Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc
2018-01-14 23:56:47
164
原创 Power of Two
LeetCode原题:Power of TwoGiven an integer, write a function to determine if it is a power of two.Credits:Special thanks to @jianchao.li.fighter for adding this problem and creating all test case
2018-01-07 23:12:32
196
原创 Algorithms(算法概论) Page.263 Exercises 8.10
Algorithms(算法概论) Page.264 Exercises 8.108.10. Proving NP-completeness by generalization. For each of the problems below, prove that it is NPcomplete by showing that it is a generalization
2017-12-31 22:54:08
333
原创 Happy Number
LeetCode原题: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
2017-12-24 23:42:39
241
原创 Search Insert Position
LeetCode原题:Search Insert PositionGiven 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 m
2017-12-10 23:36:41
172
原创 Implement strStr()
LeetCode原题:Implement strStr()Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.主要内容:这道题让我们在一个字符串中找另一个字符串第一次出现的位置解题思想:首先
2017-12-04 00:00:05
147
原创 Valid Parentheses
LeetCode原题:Valid ParenthesesGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "(
2017-11-18 23:37:08
135
原创 Longest Common Prefix
LeetCode原题:Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.主要内容:返回给定字符串数组里面所有字符串的最长公共前缀解题思想:1.一般以第一个字符串作为对比,将
2017-11-12 23:14:16
145
原创 Palindrome Number
LeetCode原题:Palindrome NumberDetermine whether an integer is a palindrome. Do this without extra space.Spoilers:Could negative integers be palindromes? (ie, -1)If you are thinking of conver
2017-11-05 18:51:49
161
原创 Remove Element
leetcode原题: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
2017-10-29 23:33:38
304
原创 Reverse Integer
leetcode原题:Reverse IntegerDescription:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321Note:The input is assumed to be a 32-bit signed integ
2017-10-29 19:30:20
258
原创 Roman to Integer
罗马数字转阿拉伯数字,以前没有做过这题,但是可能有类似的做过,主要注意的地方:思路:分段处理罗马数字,然后将每个段的值相加其中:判断如果当前位所指的字符代表的数值等于上一位,则将当前位所指的字符代表的数值添加进用来保存分段值的temp;判断如果当前位所指的字符代表的数值大于上一位,则用当前位所指的字符代表的数值减去上一位,存入用来保存分段值的temp;判断如果当前位所指的字
2017-10-15 16:51:02
177
原创 Two Sum
Description:Description: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 solutio
2017-09-10 23:29:21
268
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人