LeetCode Longest Common Prefix Write a function to find the longest common prefix string amongst an array of... Read More

# Monthly Archives: January 2016

# LeetCode Roman to Integer

LeetCode Roman to Integer Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 这一题是LeetCode Integer to... Read More

# LeetCode Integer to Roman

LeetCode Integer to Roman Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to... Read More

# LeetCode Container With Most Water

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 lines, which... Read More

# LeetCode Decode Ways

LeetCode Decode Ways A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, determine the total number of ways to decode... Read More

# LeetCode Distinct Subsequences

LeetCode Distinct Subsequences Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters... Read More

# LeetCode Palindrome Partitioning II

LeetCode Palindrome Partitioning II Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. For example, given s = "aab", Return 1 since the palindrome... Read More

# LeetCode Palindrome Number

LeetCode Palindrome Number Determine 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 to string, note the restriction of using... Read More

# LeetCode String to Integer (atoi)

LeetCode 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. Notes: It is... Read More

# LeetCode Reverse Integer

LeetCode Reverse Integer Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you thought about this?Here are some good questions to ask before coding. Bonus points for you if you have already thought through... Read More