Given a sorted linked list, delete all duplicates such that each element appear only once. Example…
分类:LeetCode题目解答
LeetCode 090 Subsets II
题目描述 Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: El…
[LeetCode] Palindrome Partitioning 拆分回文串
Given a string s, partition s such that every substring of the partition is a palindrome…
[LeetCode] Guess Number Higher or Lower 猜数字大小
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You …
[Leetcode] Pow(x, n) 实现乘方函数
Pow(x, n) Implement pow(x, n) 递归法 复杂度 时间 O(logN) 空间 O(logN) 思路 通过一点点数学推导我们可以知道,如果n是偶数$$ x^nx^n = x^{2n}$$如果n是奇…
[LeetCode] Maximum Subarray 最大子数组
Find the contiguous subarray within an array (containing at least one number) which has the largest sum…
LeetCode | Convert Sorted List to Binary Search Tree
题目: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced B…
[LeetCode] Implement strStr() 实现strStr()函数
Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is…
[LeetCode] Construct Binary Tree from String 从字符串创建二叉树
You need to construct a binary tree from a string consisting of parenthesis and integers. The whole inp…
[LeetCode] Max Area of Island 岛的最大面积
Given a non-empty 2D array grid of 0’s and 1’s, an island is a group of…
LeetCode | Rotate List
题目: Given a list, rotate the list to the right by k places, where k is non-negative. For e…
【leetcode】41. First Missing Positive 求不在给定数组里的最小的正整数
1. 题目 Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] retu…