两数相除——不允许使用高级运算

2017-08-07
阅读 1 分钟
5.9k
Divide two integers without using multiplication, division and mod operator.

合并n个已排序的链表

2017-07-19
阅读 2 分钟
1.9k
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.

构造n个成对括号

2017-07-19
阅读 2 分钟
2k
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

合并两个已排序的链表

2017-07-04
阅读 2 分钟
4.3k
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.

验证大小中括号是否成对闭合匹配

2017-07-04
阅读 1 分钟
4.2k
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

移除链表倒数第n个元素

2017-07-03
阅读 2 分钟
2k
Given a linked list, remove the nth node from the end of list and return its head.

四元组相加获得target

2017-07-03
阅读 2 分钟
1.9k
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 array which gives the sum of target.

九宫格键盘输入

2017-07-03
阅读 2 分钟
5.7k
Given a digit string, return all possible letter combinations that the number could represent.

三元组相加获得结果最接近target

2017-07-02
阅读 2 分钟
4.3k
Given an array S of n integers, find three integers in S such that the sum is closest to a given number: target.

三元组相加获得target

2017-07-02
阅读 2 分钟
5.1k
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0

字符串数组最长公共前缀

2017-07-02
阅读 2 分钟
6.1k
Write a function to find the longest common prefix string amongst an array of strings.

罗马数字转换成阿拉伯数字

2017-07-01
阅读 1 分钟
8.2k
罗马数字转换成阿拉伯数字 Roman to integer 给出一个罗马数字(字符串),返回此数字的阿拉伯数字(int) Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. example 1 {代码...} 思路 dict存储单个罗马字母代表的阿拉伯数字 初始状态sum = 0,循环遍历字...

阿拉伯数字转换成罗马数字

2017-07-01
阅读 2 分钟
7.3k
阿拉伯数字转换成罗马数字 Integer to Roman 给出一个阿拉伯数字,返回此数字的罗马数字表示 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. example 1 {代码...} 思路 用表记录关键的罗马数字和阿拉伯数字,将输入循环除以1000,900,500 ... 这些关键...

容器最大盛水量

2017-07-01
阅读 18 分钟
4.6k
容器最大盛水量 Container With Most Water 给定n个非负整数a1,a2,...,an,其中每个表示坐标(i,ai)处的点。 绘制n条垂直线,使得线i的两个端点在(i,ai)和(i,0)处。 找到两条线,它们与x轴一起形成一个容器,使得容器含有最多的水。 注意:您不得倾斜容器,n至少为2。 Given n non-negative integers a1, a2,...

从数组中寻找和的相加数

2017-07-01
阅读 2 分钟
3.6k
Given an array of integers, return indices of the two numbers such that they add up to a specific target.

两个用链表表示的数字相加

2017-07-01
阅读 2 分钟
4.8k
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 it as a linked list.

手动实现.*正则表达式匹配函数

2017-07-01
阅读 2 分钟
4.3k
手动实现.*正则表达式匹配函数 regular expression matching '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). Some examples: {代码...} 思路 使用迭代,当p[1] != '*'每次判断p[0] == s[0]后令s = s[1:], p ...

合并两棵二叉树

2017-07-01
阅读 2 分钟
3.8k
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.

不使用任何额外变量判断回文数字

2017-07-01
阅读 1 分钟
2.3k
Determine whether an integer is a palindrome. Do this without extra space.

实现atoi函数(string转integer)

2017-07-01
阅读 2 分钟
3k
Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible to gather all the input requirements up front..

查询两个数组的中位数

2017-07-01
阅读 2 分钟
2.9k
There are two sorted arrays nums1 and nums2 of size m and n respectively.

查找字符串最长回文

2017-07-01
阅读 1 分钟
2.5k
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.

寻找最长不重复子串

2017-06-30
阅读 1 分钟
7.1k
Given a string, find the length of the longest substring without repeating characters.