题目描述 Given an index k, return the kth row of the Pascal’s triangle. For example, given k = 3, Return [1,3,3,1]…
分类:LeetCode题目解答
[LeetCode] Plus One 加一运算
Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored s…
[LeetCode] Partition List 划分链表
Given a linked list and a value x, partition it such that all nodes less than x come bef…
[LeetCode] Add Digits 加数字
Given a non-negative integer num, repeatedly add all its digits until the result has only one digi…
[LeetCode] Output Contest Matches 输出比赛匹配对
During the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, li…
LintCode 在二叉查找树中插入节点
题目 给定一棵二叉查找树和一个新的树节点,将节点插入到树中。 你需要保证该树仍然是一棵二叉查找树。 分析 分别用递归和非递归两种方法实现。本质上会发现,两种方法类似 public class Solution { /**…
LeetCode | ZigZag Conversion
题目: The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: …
[LeetCode] Longest Substring Without Repeating Characters 最长无重复字符的子串,Isomorphic Strings
Given a string, find the length of the longest substring without repeating characters. Exampl…
[LeetCode] Find Largest Value in Each Tree Row 找树每行最大的结点值
You need to find the largest value in each row of a binary tree. Example: Input: 1 / \ 3 2 / \ \ 5 3 9 …
LeetCode 148 Sort List
题目描述 Sort a linked list in O(n log n) time using constant space complexity. 分析 O(n log n) 的时间复杂度,归并排序最好,因为它不会因…
LeetCode 071 Simplify Path
题目描述 Given an absolute path for a file (Unix-style), simplify it. For example, path = “/home/”, => “/home” …
[LeetCode] Linked List Components 链表组件
We are given head, the head node of a linked list containing unique integer values. We a…