
LeetCode-牛客网-Java
随风而醒
我是个疯子,虽然我在服新药,但仍旧有幻觉
展开
-
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 from the root node down to the nearest leaf node. 给一个二叉树,求二叉树的最小深度,即从根节点到最近的叶子节点的距离。方法一原创 2017-07-01 18:10:05 · 497 阅读 · 0 评论 -
LeetCode-Add Two Numbers
题目描述You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a l原创 2017-09-10 16:32:26 · 355 阅读 · 0 评论 -
LeetCode-longest-palindromic-substring
题目描述Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.# Leetcode# 3. Longest原创 2017-09-10 16:34:05 · 575 阅读 · 0 评论 -
LeetCode-jump-game-ii
题目描述Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is原创 2017-10-05 21:53:29 · 950 阅读 · 0 评论 -
LeetCode-jump-game
题目描述Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if原创 2017-10-05 22:12:14 · 1025 阅读 · 0 评论 -
算法再回顾-动态规划
f(n) = f(n-2) + f(n-1)上面是一道编程题的原型,菲波拉契数列;往往,我们需要求解函数f(n)的结果。一般有以下几种解法:* 递归算法分;即通过递归调用进行计算,但是这种方法计算了过多的重复值,因而效率低下* 记忆搜索算法:算法思路还是采用递归思想。不同的是,为了解决重复计算的问题,引入了一个记忆数组array[n],用来记录之前已经计算的结果,防止重复计算。* 动...原创 2019-04-09 22:48:41 · 954 阅读 · 0 评论 -
分治递归-贪心算法
贪心者,若不犯人,远甚奉献;奉献者,受困于感,舍大为小;分治递归:递归是一种方法调用方式,深度调用,形式类似于栈的进出。分治的思想最简单的形式就是归并排序,同归讲一个问题拆分为多个问题来求解。分治和递归之所以有联系,是因为大多数场景下,分治的算法,都是同归递归调用来求解的。这样的问题往往也可以通过动态规划来求解常见题型:归并排序、求平方根、指数pow计算恢复IP地址:25525511...原创 2019-04-17 23:10:22 · 1597 阅读 · 0 评论