Given a linked list and a value x, partition it such that all nodes less than x come before nod…
分类:LeetCode题目解答汇总
LeetCode | Count and Say(统计并输出)
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1&nbs…
LeetCode | ZigZag Conversion(锯齿形转换)
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you…
LeetCode | Binary Tree Maximum Path Sum(二叉树的路径最大值)
Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. For exampl…
LeetCode | Path Sum II(路径和2)
Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum. F…
【剑指offer】面试题11:数值的整数次方
主要考察的是代码的完整性:是否将所有情况考虑清楚,以及错误的输入情况。考察思考问题是否全面。 题目描述: 给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。 输…
LeetCode | First Missing Positive(第一个缺失的正整数)
Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] …
LeetCode | Combination Sum(元素的和)
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C wher…
LeetCode | Container with most water(装最多的水)
Given n non-negative integers a1, a2, …, an, where each represents a point at c…
LeetCode | Combination Sum II(元素的和---2)
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C&nb…
LeetCode | Best Time to Buy and Sell Stock III(股票购买抛售问题III)
Say you have an array for which the ith element is the price of a given stock on day i. Design …
LeetCode | Remove Duplicates from Sorted List(删除链表中重复的数据)
Given a sorted linked list, delete all duplicates such that each element appear only once. For example, G…