LeetCode

LeetCode 14:Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.     一个函数,传入一个字符串数组,返回所有数组元素里公共前缀的最长子串 可以以第一个字符串为基准,遍历st...

LeetCode 13:Roman to Integer

Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 这里需要从罗马数字换成整型 看看记数规则 记数方法 基本字符 I V X L C D M...

LeetCode 12:Integer to Roman

Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999.   题目很简短,将整型数字转换成罗马数字,问题变成了了解罗马数字的规律了,网上搜了下 ...

LeetCode 11: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 t...

LeetCode 10:Regular Expression Matching

Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire ...

LeetCode 9:Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of converting the...

LeetCode 8: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 ca...

LeetCode 7:Reverse Integer

Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321   Example 2: Input: -123 Output: -321   Example 3: Input: 120 Output: 21   Note:Assume we are deal...

LeetCode 6: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 N A P L S I ...

LeetCode 4: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)). Example 1: nums1 = [1, ...

LeetCode 5: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: Input: "babad" Output: "bab" Note: "aba" is also a valid answer.   Ex...

LeetCode 2: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 an...

LeetCode 1: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 ...

Excel Sheet Column Title

Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 –>...

Excel Sheet Column Number 续

Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 .....

Excel Sheet Column Number

Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ... ...

浙ICP备16024533号

浙公网安备 33010802007459号