![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
文章平均质量分 83
Guo15331092
这个作者很懒,什么都没留下…
展开
-
LeetCode No.45 JumpGame 2 题解
LeetCode No.45 JumpGame 2 题解###**题目分析**题目的大概意思就是给出一个从每个点**最多**能向前跳的步数, 问至少需要多少步能够跳到数组尾端。这个**最多**要引起注意。 之前没有仔细思考, 认为这是一道DP题。 不过这仍不失为一种解法(虽然时间复杂度来说不够好)原创 2017-09-24 16:21:40 · 299 阅读 · 0 评论 -
LeetCode 732. My Calendar III
LeetCode 732. My Calendar III题目描述 Implement a MyCalendarThree class to store your events. A new event can always be added. Your class will have one method, book(int start, int end). Formally, th原创 2017-12-24 03:28:47 · 1248 阅读 · 0 评论 -
LeetCode 97. Interleaving String 题解
LeetCode 97. Interleaving String 题解题目描述 Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aad原创 2017-11-27 10:59:02 · 315 阅读 · 0 评论 -
LeetCode Union-Find(并查集) 专题(二)
LeetCode Union-Find(并查集) 专题(二)并查集 Union-Find 的适用情况如何考虑使用并查集从并查集的功能入手, 显然题目要求有 “查询”, “合并” 操作时可以考虑使用。重点是合并。(单考虑查询用map即可)并且注意到这种合并应该是不需要记录合并路径的。(这是由于路径压缩会破坏原有路径, 破坏了原有的树结构)从我做到的题来看, 并查集的使用具有很明显的特点。 一是经常和B原创 2017-12-12 20:45:04 · 1836 阅读 · 0 评论 -
LeetCode Union-Find(并查集) 专题(一)
LeetCode Union-Find(并查集) 专题(一)前言: 写这个专题本意还是和之前一样 ,一篇一篇写博客写的腻了。来个专题换换感觉。(手动滑稽好吧其实是觉得并查集是一个比较实用的数据结构。 之前听老师在课上提到过一次, 在那之前很早就听过这个, 也是一只因为懒没去真正了解。 趁着这两天空闲时间把它熟悉了一下, 发现并不难。(难度和二分查找的变式差不多吧)下面进入正题。LeetCode原创 2017-12-03 17:27:30 · 7312 阅读 · 4 评论 -
LeetCode 42. Trapping Rain Water 题解
LeetCode 42. Trapping Rain Water 题解题目描述 Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For原创 2017-12-03 01:31:50 · 298 阅读 · 0 评论 -
LeetCode 600. Non-negative Integers without Consecutive Ones 题解
LeetCode 600. Non-negative Integers without Consecutive Ones 题解题目描述 Given a positive integer n, find the number of non-negative integers less than or equal to n, whose binary representations do NOT c原创 2017-11-20 09:25:34 · 436 阅读 · 1 评论 -
LeetCode 149. Max Points on a Line
LeetCode 149. Max Points on a Line题目描述 Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.题目分析题目大意是给出平面上nn个点的坐标, 求出这其中最多有多少个点在同一条直线上。首先进行复杂度下界的分析。 首先由原创 2017-11-20 09:24:51 · 255 阅读 · 0 评论 -
LeetCode 239. Sliding Window Maximum 题解(下)
LeetCode 239. Sliding Window Maximum 题解(下)题目描述 Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbe原创 2017-10-15 18:32:43 · 306 阅读 · 0 评论 -
LeetCode 239. Sliding Window Maximum 题解(上)
LeetCode 239. Sliding Window Maximum 题解(上)496. Next Greater Element I 题解一点说明: 这篇博客其实是主要写 496. Next Greater Element I 题解 的。主要是这次做题过程中十分有意思。真的是巧合。 所以干脆换了种写博客的方式。 至于主标题为什么是LeetCode 239. Sliding Window Ma原创 2017-10-15 18:31:54 · 450 阅读 · 0 评论 -
LeetCode 403. Frog Jump 题解
LeetCode 403. Frog Jump 题解题目描述 A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump in原创 2017-11-08 22:11:51 · 912 阅读 · 0 评论 -
LeetCode Weekly Contest 56 解题报告
LeetCode Weekly Contest 56 解题报告对应No.717,718,719,443No.717, 718, 719,443 的题解。如前面几篇博客中说的那样, 我想换些形式来写这东西。(毕竟有一定的任务性质, 还是有点枯燥的) 这种以Contest的形式早就想过了, 只不过之前Contest的题没有完整做出过 Orz….. 总算这次的题略水一点。就先做一次合集吧。T717T_原创 2017-11-08 22:11:17 · 299 阅读 · 0 评论 -
LeetCode 57. Insert Interval 题解
LeetCode 57. Insert Interval 题解题目描述 Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sort原创 2017-10-23 09:07:21 · 293 阅读 · 0 评论 -
LeetCode 51. N-Queens 题解
LeetCode 51. N-Queens 题解题目描述 The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct soluti原创 2017-10-23 09:06:29 · 311 阅读 · 0 评论 -
LeetCode No.84 Largest Rectangle in Histogram 题解
LeetCode No.84 Largest Rectangle in Histogram 题解题目描述 Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the原创 2017-10-08 20:16:11 · 267 阅读 · 0 评论 -
LeetCode No.233 Number of Digit One 题解
LeetCode No.233 Number of Digit One 题解题目描述 Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. For example: Given n = 13,原创 2017-10-08 20:14:05 · 388 阅读 · 0 评论 -
C++多态,虚函数小结
1. 什么是多态? 从行为(效果)上看, 多态即使相同的执行代码(或者调用方式)因参数传入不同(可以是参数类型, 也可以是参数个数,也可以只是参数的内存实体不同),而产生不同效果(实际调用了不同函数)。 针对虚函数的是动态多态性。其更加具体的效果是: 用几乎完全相同(参数类型, 个数相同)的调用方式, 达到不同的调用效果。原创 2017-09-16 01:37:02 · 298 阅读 · 0 评论 -
LeetCode No.76 Minimum Window Substring 题解
LeetCode No.76 Minimum Window Substring 题解题目描述 Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example, S = "A原创 2017-09-24 16:23:15 · 280 阅读 · 0 评论 -
LeetCode 297. Serialize and Deserialize Binary Tree
LeetCode 297. Serialize and Deserialize Binary Tree题目描述 Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buff原创 2018-01-01 22:07:50 · 399 阅读 · 0 评论