返回排序二叉树第K小的数 还是用先序遍历,记录index和K进行比较 程序运行动态演示 http://simpledsp.com/FS/Html/lc230.html ...
分类:
其他好文 时间:
2019-08-13 09:13:09
阅读次数:
76
BUG全集 写给自己看的 每次代码容易出问题,有的时候还是重复的,想写很久了 这次来更,为了以后写题少一些bug,多一些时间想正解! 1. dfs 首先dfs不要写傻了 有一道题比方说要选n个步骤 每个步骤有3种 是对一个数列进行不同的修改,这时候一边选步骤,一边修改,是比选完n个步骤再一次性修改要 ...
分类:
其他好文 时间:
2019-08-12 01:03:35
阅读次数:
89
输入一个链表,输出该链表中倒数第k个结点。 ...
分类:
其他好文 时间:
2019-08-10 23:07:21
阅读次数:
179
(链接点这儿) 题目: The GCD of two positive integers is the largest integer that divides both the integers without any remainder. The LCM of two positive inte ...
分类:
其他好文 时间:
2019-08-10 20:59:27
阅读次数:
85
就是用快排那种划分,每次确定一个最终元素的位置,如果该位置是要找的数,则返回 ...
分类:
其他好文 时间:
2019-08-08 21:29:48
阅读次数:
106
problem 976. Largest Perimeter Triangle solution: 参考 1. Leetcode_easy_976. Largest Perimeter Triangle; 完 ...
分类:
其他好文 时间:
2019-08-07 19:33:51
阅读次数:
86
221 medium 221. Maximal Square Medium Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its are ...
分类:
其他好文 时间:
2019-08-06 20:01:38
阅读次数:
68
单调栈和队列讲解:传送门 HDU -1506题意: 就是给你一些矩形的高度,让你统计由这些矩形构成的那个矩形面积最大 如上图所示,如果题目给出的全部是递增的,那么就可以用贪心来解决 从左向右依次让每一个矩形的高度当作最后的高度,来从中选取最大值就可以了 但是如果它不是递增的,中间会出现低谷,那么要还 ...
分类:
其他好文 时间:
2019-07-31 18:59:28
阅读次数:
110
https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Medium https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Medium https://leetco ...
分类:
其他好文 时间:
2019-07-29 20:15:18
阅读次数:
104
package com.dh.test; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.ReentrantLock; public class ReentrantLockTest { // 参考:htt... ...
分类:
其他好文 时间:
2019-07-29 14:15:46
阅读次数:
62