LeetCode
jerryhk
这个作者很懒,什么都没留下…
展开
-
LeetCode: Longest Palindromic Substring
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: “babad”Output: “bab”Note: “aba” is also a valid answer.Example ...原创 2019-02-21 18:38:31 · 114 阅读 · 0 评论 -
LeetCode: Roman to Integer
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...原创 2019-02-27 10:52:00 · 115 阅读 · 0 评论 -
LeetCode: 3Sum
Given an array nums of n integers, are there elements a, b, c in nums 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 contai...原创 2019-03-03 13:59:53 · 97 阅读 · 0 评论 -
LeetCode: Integer to Roman
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...原创 2019-02-27 09:55:34 · 100 阅读 · 0 评论 -
LeetCode: Container With Most Water
Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two l...原创 2019-02-26 20:49:02 · 145 阅读 · 0 评论 -
LeetCode: Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string “”.Example 1:Input: ["flower","flow","flight"]Output: "fl...原创 2019-03-02 22:07:08 · 108 阅读 · 0 评论 -
LeetCode: Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplanation...原创 2019-02-26 09:03:10 · 139 阅读 · 0 评论 -
LeetCode: String to Integer (atoi)
Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this...原创 2019-02-25 22:21:56 · 148 阅读 · 0 评论 -
LeetCode: Reverse Integer
Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dealing with an ...原创 2019-02-25 16:05:03 · 131 阅读 · 0 评论 -
LeetCode: ZigZag Conversion
The 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 NA P L S I I G...原创 2019-02-24 15:25:46 · 85 阅读 · 0 评论 -
LeetCode: 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...原创 2019-02-21 19:06:40 · 82 阅读 · 0 评论 -
LeetCode: 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 i...原创 2019-02-21 19:00:24 · 113 阅读 · 0 评论 -
LeetCode: Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example 2:Input: ...原创 2019-02-21 18:55:24 · 84 阅读 · 0 评论 -
LeetCode: Median of Two Sorted Arrays
There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assume nums1 and num...原创 2019-02-21 18:49:10 · 83 阅读 · 0 评论 -
LeetCode: 3Sum Closest
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would ...原创 2019-03-31 13:57:05 · 100 阅读 · 0 评论