
数据结构
文章平均质量分 89
日常刷题
Yanliang_
The man who has made up his mind to win will never say "impossible ".
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode – 583. Delete Operation for Two Strings
Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one character in eith...原创 2019-02-11 11:36:54 · 210 阅读 · 0 评论 -
LeetCode – 759. Employee Free Time
We are given a list schedule of employees, which represents the working time for each employee. Each employee has a list of non-overlapping Intervals, and these intervals are in sorted order. Ret...原创 2019-02-11 11:35:50 · 558 阅读 · 0 评论 -
LeetCode – 198. House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent hous...原创 2019-02-11 11:34:55 · 196 阅读 · 0 评论 -
LeetCode – 740. Delete and Earn
Given an array nums of integers, you can perform operations on the array. In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must...原创 2019-02-11 11:32:40 · 348 阅读 · 0 评论 -
LeetCode – 802. Find Eventual Safe States
In a directed graph, we start at some node and every turn, walk along a directed edge of the graph. If we reach a node that is terminal (that is, it has no outgoing directed edges), we stop. ...原创 2019-02-11 11:31:08 · 281 阅读 · 0 评论 -
LeetCode – 739. Daily Temperatures
Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer temperature. If there is no future day for...原创 2019-02-11 11:29:46 · 308 阅读 · 0 评论 -
LeetCode – 718. Maximum Length of Repeated Subarray
Given two integer arrays A and B, return the maximum length of an subarray that appears in both arrays. Example 1: Input: A: [1,2,3,2,1] B: [3,2,1,4,7] Output: 3 Explanation: The ...原创 2019-02-11 11:28:39 · 275 阅读 · 0 评论 -
LeetCode – 752. Open the Lock
You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots:'0', '1', '2', '3', '4', '5', '6', '7', '8', '9' The wheels can rotate freely and wrap around: for example, we can turn...原创 2019-02-11 11:27:19 · 259 阅读 · 0 评论 -
LeetCode – 801. Minimum Swaps To Make Sequences Increasing
We have two integer sequences A and B of the same non-zero length. We are allowed to swap elements A[i] and B[i]. Note that both elements are in the same in...原创 2019-02-11 11:25:52 · 226 阅读 · 0 评论 -
LeetCode - 875. Koko Eating Bananas
Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards have gone and will come back in H hours. Koko can decide her bananas-per-hour eating speed ...原创 2019-02-11 11:23:21 · 303 阅读 · 0 评论 -
最长斐波那契序列-LeetCode-873
英文版 A sequence X_1, X_2, …, X_n is fibonacci-like if: n >= 3 X_i + X_{i+1} = X_{i+2} for all i + 2 <= n Given a strictly increasing array A of positive integers forming a sequence, find the le...原创 2018-10-09 22:12:40 · 455 阅读 · 0 评论 -
杀死进程-LeetCode-582
英文版 582. Kill Process Given n processes, each process has a unique PID (process id) and its PPID (parent process id). Each process only has one parent process, but may have one or more children proces...原创 2018-10-11 08:53:14 · 2760 阅读 · 0 评论 -
快速排序及优化
快速排序 原理 快速排序是C.R.A.Hoare提出的一种交换排序。它采用分治的策略,所以也称其为分治排序。 实现快速排序算法的关键在于,先在数组中选一个数作为基数,接着以基数为中心将数组中的数字分为两部分,比基数小的放在数组的左边,比基数大的放到数组的右边。接下来我们可以用递归的思想分别对基数的左右两边进行排序。 整个快速排序可以总结为以下三步: 从数组中取出一个数作为基数 分区...原创 2018-05-21 20:05:14 · 311 阅读 · 0 评论 -
常用排序算法总结
排序 定义 排序是计算机内经常进行的一种操作,其目的是将一组“无序”的记录序列调整为“有序”的记录序列。 输入:n个数:a1,a2,a3,…,an 输出:n个数的排列:a1’,a2’,a3’,…,an’,使得a1’<=a2’<=a3’<=…<=an’。 导致算法优劣的因素 稳定:如果a原本在b前面,而a=b,排序之后a仍然在b的前面; 不稳定:如果a原...原创 2018-04-05 12:03:53 · 188 阅读 · 0 评论 -
堆排序
阅读原文 堆排是基于堆的一种排序算法,对于堆的了解,请看什么是堆排序(如果对堆的插入和删除不清楚,强烈建议先看堆),今天我们聊聊堆排的思想,复杂度以及稳定性。 堆排思想 前情回顾:克给谦子解决了时间管理上的问题:什么是堆排序 过了几天后,谦子高兴地跑到老师跟前 早知不来了,谦子心想 谦子心想:上次去溪边游玩不是已经出过这个题吗,当时学会了冒泡排序,这次肯定不是那...原创 2018-01-02 22:43:28 · 282 阅读 · 0 评论