[LeetCode] 165. Compare Version Numbers

2019-01-14
阅读 2 分钟
1.4k
Compare two version numbers version1 and version2.If version1 > version2 return 1; if version1 < version2 return -1;otherwise return 0.

[LeetCode] 51. N-Queens

2018-12-30
阅读 2 分钟
2.3k
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.

[LeetCode] 249. Group Shifted Strings

2018-12-30
阅读 2 分钟
2.1k
Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "shifting" which forms the sequence:

[LeetCode] 332. Reconstruct Itinerary

2018-12-30
阅读 2 分钟
1.5k
Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK. Thus, the itinerary must begin with JFK.

[LeetCode] 767. Reorganize String

2018-12-27
阅读 2 分钟
2.2k
Given a string S, check if the letters can be rearranged so that two characters that are adjacent to each other are not the same.

[LeetCode] 402. Remove K Digits

2018-12-26
阅读 2 分钟
1.9k
Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.

[LeetCode] 722. Remove Comments

2018-12-26
阅读 4 分钟
1.2k
Given a C++ program, remove comments from it. The program source is an array where source[i] is the i-th line of the source code. This represents the result of splitting the original source code string by the newline character n.

[LeetCode] 657. Robot Return to Origin

2018-12-25
阅读 2 分钟
1.1k
There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes its moves.

[LeetCode] 71. Simplify Path

2018-12-17
阅读 2 分钟
1.4k
In a UNIX-style file system, a period ('.') refers to the current directory, so it can be ignored in a simplified path. Additionally, a double period ("..") moves up a directory, so it cancels out whatever the last directory was. For more information, look here: [链接]

[LeetCode] 243. Shortest Word Distance

2018-12-14
阅读 1 分钟
1.6k
Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list.

[LeetCode] 93. Restore IP Addresses

2018-12-12
阅读 1 分钟
2.3k
Given a string containing only digits, restore it by returning all possible valid IP address combinations.

[LeetCode] 953. Verifying an Alien Dictionary

2018-12-10
阅读 2 分钟
2.1k
In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters.

[LeetCode] 214. Shortest Palindrome

2018-12-05
阅读 1 分钟
1.7k
Given a string s, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by performing this transformation.

[LeetCode] 859. Buddy Strings

2018-12-03
阅读 2 分钟
2.3k
Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B.

[LeetCode] 929. Unique Email Addresses

2018-12-03
阅读 2 分钟
2.1k
Every email consists of a local name and a domain name, separated by the @ sign.

[LeetCode] 842. Split Array into Fibonacci Sequence

2018-11-25
阅读 2 分钟
2.5k
Given a string S of digits, such as S = "123456579", we can split it into a Fibonacci-like sequence [123, 456, 579].

[LeetCode] 65. Valid Number

2018-11-24
阅读 2 分钟
1.5k
Note: It is intended for the problem statement to be ambiguous. You should gather all requirements up front before implementing one. However, here is a list of characters that can be in a valid decimal number:

[LeetCode] 556. Next Greater Element III

2018-11-22
阅读 2 分钟
1.7k
Given a positive 32-bit integer n, you need to find the smallest 32-bit integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive 32-bit integer exists, you need to return -1.

[LeetCode] 68. Text Justification

2018-11-20
阅读 4 分钟
1.4k
Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justified.

[LeetCode] 336. Palindrome Pairs

2018-11-20
阅读 3 分钟
2.7k
Given a list of unique words, find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i] + words[j] is a palindrome.

[LeetCode] 291. Word Pattern II

2018-11-19
阅读 2 分钟
3.2k
Given a pattern and a string str, find if str follows the same pattern.

[LeetCode] 408. Valid Word Abbreviation

2018-11-17
阅读 2 分钟
2.5k
Given a non-empty string s and an abbreviation abbr, return whether the string matches with the given abbreviation.

[LeetCode] 678. Valid Parenthesis String

2018-11-15
阅读 2 分钟
1.6k
Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this string is valid. We define the validity of a string by these rules:

[LeetCode] 606. Construct String from Binary Tree

2018-11-09
阅读 2 分钟
1.9k
You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.

[LeetCode] 640. Solve the Equation

2018-11-09
阅读 2 分钟
2.6k
Solve a given equation and return the value of x in the form of string "x=#value". The equation contains only '+', '-' operation, the variable x and its coefficient.

[LeetCode] 917. Reverse Only Letters

2018-11-08
阅读 1 分钟
2.7k
Given a string S, return the "reversed" string where all characters that are not a letter stay in the same place, and all letters reverse their positions.

[LeetCode] 171. Excel Sheet Column Number

2018-11-06
阅读 1 分钟
1.3k
Given a column title as appear in an Excel sheet, return its corresponding column number.

[LeetCode] 388. Longest Absolute File Path

2018-11-04
阅读 2 分钟
1.3k
Suppose we abstract our file system by a string in the following manner:

[LeetCode] 686. Repeated String Match

2018-10-31
阅读 1 分钟
2.1k
Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1.

[LeetCode] 681. Next Closest Time

2018-10-31
阅读 2 分钟
3k
Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit can be reused.