这题目很有意思. 一开始分析的太复杂, 最后按照这个哥们的想法(http://yuanhsh.iteye.com/blog/2219891) 的来做,反而简单了许多。 设定T(n)的做法,最后题目化简以后就跟Fibona…
分类:LeetCode
LeetCode | Unique Binary Search Trees II
题目: Given n, generate all structurally unique BST’s (binary search trees) that store valu…
【leetcode】23. Merge k Sorted Lists 多个有序链表的合并有序
1. 题目 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 2. 思路…
LeetCode 557. 反转字符串中的单词 III
题目描述 给定一个字符串,你需要反转字符串中每个单词的字符顺序,同时仍保留空格和单词的初始顺序。 示例 1: 输入: "Let's take LeetCode contest" 输出: "s'teL ekat edoCt…
[LeetCode] Next Greater Element I 下一个较大的元素之一
You are given two arrays (without duplicates) nums1 and nums2 where nums1…
LeetCode | Minimum Depth of Binary Tree(树的最短路径)
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path …
Leetcode1——Two Sum
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书 1. 问题描述 Given an array of integers, return indi…
Leetcode在线课程 - 算法基础 - 数组/字符串
关于我的 Leetcode 题目解答,代码前往 Github:https://github.com/chenxiangcyr/leetcode-answers Leetcode上有一门很小的在线课程,叫算法基础(Algo…
293. Flip Game
My Submissions Total Accepted: 15789 Total Submissions: 29826 Difficulty: Easy Contributors: Admin You are pla…
LeetCode 84. Largest Rectangle in Histogram 单调栈应用
LeetCode 84. Largest Rectangle in Histogram 单调栈应用 leetcode+ 循环数组,求右边第一个大的数字 求一个数组中右边第一个比他大的数(单调栈 LeetCode——寻找数…
24. Swap Nodes in Pairs
24. Swap Nodes in Pairs 题目 Given a linked list, swap every two adjacent nodes and return its head. For example…
[LeetCode] Two Sum II - Input array is sorted 两数之和之二 - 输入数组有序
Given an array of integers that is already sorted in ascending order, find two numbers such that they a…