
leetcode
文章平均质量分 76
javays1
这个作者很懒,什么都没留下…
展开
-
leetcode 1 Two Sum
leetcode 是一个以经典面试题为题库的OJ,上面的第一题便是这道Two Sum, 题目很简单。 Two Sum Total Accepted: 119107 Total Submissions: 673743 Given an array of integers, find two numbers such that they add up to a specific t原创 2015-08-08 10:48:20 · 318 阅读 · 0 评论 -
leetcode 8
String to Integer (atoi) Total Accepted: 60497 Total Submissions: 471866 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a原创 2015-08-18 03:31:22 · 334 阅读 · 0 评论 -
leetcode 9 Palindrome Number
Palindrome Number Total Accepted: 74363 Total Submissions: 261192 Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Co原创 2015-08-19 12:01:20 · 328 阅读 · 0 评论 -
leetcode 42 Trapping Rain Water
Trapping Rain Water Total Accepted: 47928 Total Submissions: 158168 Difficulty: Hard Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how mu原创 2015-09-22 10:59:43 · 548 阅读 · 0 评论 -
leetcode 10 Regular Expression Matching
Regular Expression Matching Total Accepted: 51566 Total Submissions: 249926 Implement regular expression matching with support for ‘.’ and ‘*’. ‘.’ Matches any single character. ‘*’ Ma原创 2015-08-22 06:56:49 · 336 阅读 · 0 评论 -
Leetcode 20 Valid Parentheses
Valid Parentheses Total Accepted: 71209 Total Submissions: 265268 Difficulty: Easy Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string i原创 2015-10-03 11:31:18 · 231 阅读 · 0 评论 -
leetcode 17 Letter Combinations of a Phone Number
Letter Combinations of a Phone Number Total Accepted: 54389 Total Submissions: 210023 Difficulty: Medium Given a digit string, return all possible letter combinations that the number could repr原创 2015-10-03 13:07:13 · 423 阅读 · 0 评论 -
leetcode 16 3Sum Closet
3Sum Closest Total Accepted: 53147 Total Submissions: 195388 Difficulty: Medium Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target.原创 2015-10-03 11:51:24 · 392 阅读 · 0 评论 -
leetcode 19 Remove Nth Node From End of List
Remove Nth Node From End of List Total Accepted: 74559 Total Submissions: 274808 Difficulty: Easy Given a linked list, remove the nth node from the end of list and return its head. For exa原创 2015-10-03 06:21:24 · 282 阅读 · 0 评论 -
leetcode 268 Missing Number
Missing Number Total Accepted: 13285 Total Submissions: 39921 Difficulty: Medium Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the arr原创 2015-09-19 07:20:23 · 419 阅读 · 0 评论 -
leetcode 18 4Sum
4Sum Total Accepted: 45122 Total Submissions: 207795 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 a原创 2015-08-31 10:30:40 · 268 阅读 · 0 评论 -
Leetcode 7 Reverse Integer
Reverse Integer Total Accepted: 89449 Total Submissions: 373087 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 这道题比较简单,我最先采用的是字符串的方法,通过库函数原创 2015-08-16 23:07:37 · 450 阅读 · 0 评论 -
leetcode 15 3Sum
3Sum Total Accepted: 70783 Total Submissions: 419673 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原创 2015-08-27 13:39:48 · 248 阅读 · 0 评论 -
leetcode 11 Container With Most Water
Container With Most Water Total Accepted: 48739 Total Submissions: 153072 Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are原创 2015-08-23 11:58:08 · 381 阅读 · 0 评论 -
leetcode 2 Add Two Numbers
leetcode的第二题比较简单,题目如下: Add Two Numbers Total Accepted: 78845 Total Submissions: 385095 You are given two linked lists representing two non-negative numbers. >The digits are stored in reverse原创 2015-08-09 10:37:43 · 299 阅读 · 0 评论 -
leetcode 12 Integer to Roman
Integer to Roman Total Accepted: 39957 Total Submissions: 116987 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.这道题目的要求简洁明了,要求原创 2015-08-24 05:00:23 · 327 阅读 · 0 评论 -
leetcode 13 Roman to Integer
Roman to Integer Total Accepted: 49270 Total Submissions: 143461 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.这道题刚好与上一道题相反,是原创 2015-08-24 05:43:07 · 541 阅读 · 0 评论 -
leetcode 14 Longest Common Prefix
Longest Common Prefix Total Accepted: 61429 Total Submissions: 241098 Write a function to find the longest common prefix string amongst an array of strings. 这道题很简单几乎没有什么可说的,我就是从首到尾挨个比较每个字符串是否相原创 2015-08-25 13:21:43 · 235 阅读 · 0 评论 -
leetcode 3 Longest Substring Without Repeating Characters
第三题我写的程序虽然AC了,但在时间上表现不好, 随后在该题的Discuss中找到一个别人写的12行的4ms代码, 感觉方法比我的更巧妙, 所以秉着学习的态度,我这里写一点我对他代码的理解. 最后也附上我的代码. 12行代码的原帖地址:https://leetcode.com/discuss/49128/4ms-c-code-in-12-linesint lengthOfLongestSubstri原创 2015-08-11 05:37:01 · 233 阅读 · 0 评论 -
leetcode 4 Median of Two Sorted Arrays
Median of Two Sorted Arrays Total Accepted: 59220 Total Submissions: 345234 There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays.原创 2015-08-12 05:30:12 · 231 阅读 · 0 评论 -
leetcode 5 Longest Palindromic Substring
Longest Palindromic Substring Total Accepted: 62794 Total Submissions: 303283 Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000,原创 2015-08-13 05:27:38 · 251 阅读 · 0 评论 -
leetcode 6 ZigZag Conversion
ZigZag Conversion Total Accepted: 50923 Total Submissions: 236853 The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this p原创 2015-08-14 05:11:45 · 221 阅读 · 0 评论 -
leetcode 287 Find the Duplicate Number
Find the Duplicate Number Total Accepted: 8673 Total Submissions: 25351 Difficulty: Hard Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove t原创 2015-10-24 23:08:35 · 552 阅读 · 0 评论