描述
Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists:
A:
...
描述
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
分析暴力搜索的话时间O(n^3),会超时。可以考虑用缓存来加速,比如对和某两点(p1, p2
...
描述
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You s
...
描述
Divide two integers without using multiplication, division and mod operator.
If it is overflow, return MAX_INT.
分析不用乘法、除法、取模运算来实现除法。可以只用加减法来实现,但是太
...
描述
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 fo
...
描述
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,Given n = 3,
You should return the foll
...
描述
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.
For example,Given the following matrix:
[
...
描述
Given an index k, return the kth row of the Pascal’s triangle.
For example, given k = 3,Return [1,3,3,1].
分析Pascal Triangle的后续。用类似动态规划的降维方式,可以实现空间
...
描述
Given numRows, generate the first numRows of Pascal’s triangle.
For example, given numRows = 5,Return
[ [1], [1,1], [1,2,1], [1,3,3,1], [
...
描述
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a co
...
描述
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-
...
描述
Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).
For example,S = “ADOBE
...
描述
Given a collection of intervals, merge all overlapping intervals.
For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18].
分析和[In
...
描述
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).
You may assume that the intervals were ini
...
描述
Determine whether an integer is a palindrome. Do this without extra space.
Some hints:Could negative integers be palindromes? (ie, -1)
If you are t
...