自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

memcpy0的博客

Humans started out with nothing but minds and hands that could build tools.

  • 博客(780)
  • 资源 (6)
  • 论坛 (2)
  • 收藏
  • 关注

原创 LeetCode C++ 807. Max Increase to Keep City Skyline【Array】中等

In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts can be different for different buildings). Height 0 is cons

2021-01-19 22:28:27 5

原创 LeetCode C++ 1261. Find Elements in a Contaminated Binary Tree【Tree/Hash Table】中等

Given a binary tree with the following rules: root.val == 0 If treeNode.val == x and treeNode.left != null, then treeNode.left.val == 2 * x + 1 If treeNode.val == x and treeNode.right != null, then treeNode.right.val == 2 * x + 2Now the binary t

2021-01-18 22:59:53 15

原创 LeetCode C++ 1184. Distance Between Bus Stops【Array/前缀和】简单

A bus has n stops numbered from 0 to n - 1 that form a circle. We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number i and (i + 1) % n.The bus goes along both directions 

2021-01-18 22:25:19 9

原创 LeetCode C++ 面试题 04.01. Route Between Nodes LCCI【Graph/BFS/DFS】中等

Given a directed graph, design an algorithm to find out whether there is a route between two nodes.Example1:Input: n = 3, graph = [[0, 1], [0, 2], [1, 2], [1, 2]], start = 0, target = 2Output: trueExample2:Input: n = 5, graph = [[0, 1], [0, 2], [0, 4

2021-01-18 20:02:15 10

原创 LeetCode C++ 814. Binary Tree Pruning【Tree/Recursion】中等

We are given the head node root of a binary tree, where additionally every node's value is either a 0 or a 1.Return the same tree where every subtree (of the given tree) not containing a 1 has been removed.(Recall that the subtree of a node X is X,

2021-01-18 18:34:46 9

原创 LeetCode C++ 821. Shortest Distance to a Character【String】简单

Given a string S and a character C, return an array of integers representing the shortest distance from the character C in the string.Example 1:Input: S = "loveleetcode", C = 'e'Output: [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0]Note:S string length is in

2021-01-18 00:16:43 15

原创 LeetCode C++ 1716. Calculate Money in Leetcode Bank【Greedy/Math】简单

Hercy wants to save money for his first car. He puts money in the Leetcode bank every day.He starts by putting in $1 on Monday, the first day. Every day from Tuesday to Sunday, he will put in $1 more than the day before. On every subsequent Monday, h

2021-01-15 15:10:00 25

原创 LeetCode C++ 1315. Sum of Nodes with Even-Valued Grandparent【Tree/DFS/BFS】中等

Given a binary tree, return the sum of values of nodes with even-valued grandparent.  (A grandparent of a node is the parent of its parent, if it exists.)If there are no nodes with an even-valued grandparent, return 0.Example 1:Input: root =

2021-01-15 13:46:55 18

原创 LeetCode C++ 1018. Binary Prefix Divisible By 5【Array】简单

Given an array A of 0s and 1s, consider N_i: the i-th subarray from A[0] to A[i] interpreted as a binary number (from most-significant-bit to least-significant-bit.)Return a list of booleans answer, where answer[i] is true if and only if N_i is divisible

2021-01-15 12:10:14 25 1

原创 LeetCode C++ 914. X of a Kind in a Deck of Cards【Array/Math】简单

In a deck of cards, each card has an integer written on it.Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where: Each group has exactly X cards. All t

2021-01-10 23:14:45 24

原创 LeetCode C++ 228. Summary Ranges【Array】简单

You are given a sorted unique integer array nums.Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of nums is covered by exactly one of the ranges, and there is no integer x such that x is in

2021-01-10 22:11:43 23

原创 LeetCode C++ 面试题 17.05. Find Longest Subarray LCCI【哈希表/前缀和】中等

Given an array filled with letters and numbers, find the longest subarray with an equal number of letters and numbers.Return the subarray. If there are more than one answer, return the one which has the smallest index of its left endpoint. If there i

2021-01-06 00:20:45 24

原创 LeetCode C++ 面试题 17.11. Find Closest LCCI【Two Pointers/Hash Table】中等

You have a large text file containing words. Given any two words, find the shortest distance (in terms of number of words) between them in the file. If the operation will be repeated many times for the same file (but different pairs of words), can you opti

2021-01-05 23:57:30 23

原创 LeetCode C++ 面试题 08.11. Coin LCCI【Dynamic Programming/Math】中等

Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents), and pennies (1 cent), write code to calculate the number of ways of representing n cents. (The result may be large, so you should return it modulo 1000000007)Example1:I

2021-01-05 23:47:28 24

原创 LeetCode C++ 830. Positions of Large Groups【String】简单

In a string s of lowercase letters, these letters form consecutive groups of the same character.For example, a string like s = "abbxxxxzyy" has the groups "a", "bb", "xxxx", "z", and "yy".A group is identified by an interval [start, end],

2021-01-05 20:47:59 23

原创 LeetCode C++ 435. Non-overlapping Intervals【贪心/排序/动态规划】中等

Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Example 1:Input: [[1,2],[2,3],[3,4],[1,3]]Output: 1Explanation: [1,3] can be removed and the rest of intervals ar

2020-12-31 15:49:48 24

原创 【英语学习】经济学人 (Intelligence Unit) 2020年12月版

The Economist Intelligence Unit - Assessing health system preparedness for multiple chronic conditions 2020链接: https://pan.baidu.com/s/11d0n-MeVW1b8Y6UkuseqXA 提取码: fdrn

2020-12-29 18:26:53 48

原创 LeetCode C++ 91. Decode Ways【Dynamic Programming/String】中等

A message containing letters from A - Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given a non-empty string containing only digits, determine the total number of ways to decode it.The answer is guara

2020-12-27 18:14:43 26

原创 LeetCode C++ 89. Gray Code【Bit Manipulation/Hash Table/Math】中等

The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.Example

2020-12-27 18:03:25 26

原创 LeetCode C++ 1130. Minimum Cost Tree From Leaf Values【Dynamic Programming/Stack/Sparse Table】中等

Given an array arr of positive integers, consider all binary trees such that: Each node has either 0 or 2 children; The values of arr correspond to the values of each leaf in an in-order traversal of the tree.  (Recall that a node is a leaf if

2020-12-26 16:10:48 48

原创 LeetCode C++ 376. Wiggle Subsequence【Dynamic Programming】中等

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with fewer than two elemen

2020-12-26 02:30:50 50

原创 LeetCode C++ 1649. Create Sorted Array through Instructions【树状数组/线段树/归并排序/平衡树】困难

Given an integer array instructions, you are asked to create a sorted array from the elements in instructions. You start with an empty container nums. For each element from left to right in instructions, insert it into nums. The cost of each insertion is t

2020-12-26 02:15:28 348

原创 LeetCode C++ 剑指 Offer 51. 数组中的逆序对【归并排序/树状数组/线段树】

在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。输入一个数组,求出这个数组中的逆序对的总数。示例 1:输入: [7,5,6,4]输出: 5限制: 0 <= 数组长度 <= 50000解法1 归并排序先这么写,日后有时间就多更新几种解法:class Solution {private: int ans = 0; vector<int> tmp; void mergeSort(vector<int>&

2020-12-26 02:07:06 57

原创 LeetCode C++ 剑指 Offer 47. 礼物的最大价值【Dynamic Programming】中等

在一个 m * n 的棋盘的每一格都放有一个礼物,每个礼物都有一定的价值(价值大于 0)。你可以从棋盘的左上角开始拿格子里的礼物,并每次向右或者向下移动一格、直到到达棋盘的右下角。给定一个棋盘及其上面的礼物的价值,请计算你最多能拿到多少价值的礼物?示例 1:输入: [ [1,3,1], [1,5,1], [4,2,1]]输出: 12解释: 路径 1→3→5→2→1 可以拿到最多价值的礼物提示:0 < grid.length <= 2000 < grid[0

2020-12-26 01:33:02 65

原创 LeetCode C++ 剑指 Offer 63. 股票的最大利润【Dynamic Programming】中等

假设把某股票的价格按照时间先后顺序存储在数组中,请问买卖该股票一次可能获得的最大利润是多少?示例 1:输入: [7,1,5,3,6,4]输出: 5解释: 在第 2 天(股票价格 = 1)的时候买入,在第 5 天(股票价格 = 6)的时候卖出,最大利润 = 6-1 = 5 。 注意利润不能是 7-1 = 6, 因为卖出价格需要大于买入价格。示例 2:输入: [7,6,4,3,1]输出: 0解释: 在这种情况下, 没有交易完成, 所以最大利润为 0。限制: 0 <= 数组长

2020-12-26 01:24:12 44

原创 LeetCode C++ 剑指 Offer 62. 圆圈中最后剩下的数字【Linked List/Math】简单

0,1,n-1这n个数字排成一个圆圈,从数字0开始,每次从这个圆圈里删除第m个数字。求出这个圆圈里剩下的最后一个数字。例如,0、1、2、3、4这5个数字组成一个圆圈,从数字0开始每次删除第3个数字,则删除的前4个数字依次是2、0、4、1,因此最后剩下的数字是3。示例 1:输入: n = 5, m = 3输出: 3示例 2:输入: n = 10, m = 17输出: 2限制:1 <= n <= 10^51 <= m <= 10^6解法 规律class

2020-12-26 01:15:18 49

原创 LeetCode C++ 978. Longest Turbulent Subarray【Dynamic Programming/Array】中等

Given an integer array arr, return the length of a maximum size turbulent subarray of arr.A subarray is turbulent if the comparison sign flips between each adjacent pair of elements in the subarray.More formally, a subarray [arr[i], arr[i + 1], ..., arr[

2020-12-25 23:22:49 25

原创 LeetCode C++ 703. Kth Largest Element in a Stream【Heap/Design】简单

Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element.Implement KthLargest class: KthLargest(int k, int[] nums) Initializes the object wi

2020-12-25 21:43:49 39

原创 LeetCode C++ 300. Longest Increasing Subsequence【Dynamic Programming/Binary Search/String】中等

Given an integer array nums, return the length of the longest strictly increasing subsequence.A subsequence is a sequence that can be derived from an array by deleting some or no elements without changing the order of the remaining elements. For example,

2020-12-25 21:02:42 28

原创 LeetCode C++ 1190. Reverse Substrings Between Each Pair of Parentheses【Deque/Stack/String】中等

You are given a string s that consists of lower case English letters and brackets.Reverse the strings in each pair of matching parentheses, starting from the innermost one.Your result should not contain any brackets.Example 1:Input: s = "(abcd)"Output

2020-12-25 17:27:18 27

原创 LeetCode C++ 227. Basic Calculator II【Stack/String】中等

Given a string s which represents an expression, evaluate this expression and return its value. The integer division should truncate toward zero.Example 1:Input: s = "3+2*2"Output: 7Example 2:Input: s = " 3/2 "Output: 1Example 3:Input: s =

2020-12-25 17:03:53 36

原创 LeetCode C++ 474. Ones and Zeroes【Dynamic Programming】中等

You are given an array of binary strings strs and two integers m and n.Return the size of the largest subset of strs such that there are at most m 0's and n 1's in the subset.A set x is a subset of a set y if all elements of x are also elements of y.Exa

2020-12-25 02:02:44 196

原创 LeetCode SQL 1179. Reformat Department Table【SELECT】简单

Table: Department+---------------+---------+| Column Name | Type |+---------------+---------+| id | int || revenue | int || month | varchar |+---------------+---------+(id, month) is the primary key of this tab

2020-12-24 23:22:52 72 1

原创 LeetCode C++ 1081. Smallest Subsequence of Distinct Characters【Greedy/Stack/String】中等

Return the lexicographically smallest subsequence of s that contains all the distinct characters of s exactly once.Example 1:Input: s = "bcabc"Output: "abc"Example 2:Input: s = "cbacdcbc"Output: "acdb"Constraints:1 <= s.length <= 1000s co

2020-12-24 23:02:26 34

原创 LeetCode C++ 316. Remove Duplicate Letters【Stack/Greedy/String】中等

Given a string s, remove duplicate letters so that every letter appears once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.Example 1:Input: s = "bcabc"Output: "abc"Example 2:Input: s

2020-12-24 22:50:16 50

原创 LeetCode C++ 135. Candy【Greedy】困难

There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at least one candy.Children with a higher rating get more candies than

2020-12-24 01:46:38 80

原创 LeetCode C++ 999. Available Captures for Rook【Array】简单

On an 8 x 8 chessboard, there is one white rook.  There also may be empty squares, white bishops, and black pawns.  These are given as characters 'R', '.', 'B', and 'p' respectively. Uppercase characters represent white pieces, and lowercase char

2020-12-24 00:13:12 36

原创 LeetCode C++ 819. Most Common Word【String/Hash Table】简单

Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words.  It is guaranteed there is at least one word that isn't banned, and that the answer is unique.Words in the list of banned words

2020-12-24 00:09:16 30

原创 LeetCode C++ 1694. Reformat Phone Number【String】简单

You are given a phone number as a string number. number consists of digits, spaces ' ', and/or dashes '-'.You would like to reformat the phone number in a certain manner. Firstly, remove all spaces and dashes. Then, group the digits from left to right int

2020-12-23 23:03:39 40

原创 LeetCode C++ 387. First Unique Character in a String【String/Hash Table】简单

Given a string, find the first non-repeating character in it and return its index. If it doesn’t exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode"return 2.Note: You may assume the string contains only lowercase English letters.题意

2020-12-23 16:48:56 50

编程小白的第一本Python入门书

一个实用主义的开发者,带你快速走进Python编程的大门。

2018-04-30

深入Python编程

这是一本关于Python的快速入门的书,"总之,不要指望这本书会按常规出牌,我希望能有惊悚小说那样的节奏和快感,免得大家翻几页后就丢在⼀一旁,白白浪费了金钱和时间,还可能成为家里的卫生死角。"作者说。

2018-04-27

Coursera机器学习笔记

吴恩达教授的Coursera机器学习笔记整理一到一十八章全

2018-04-22

Python编程

很有趣的一本Python书,学完后可以做各种项目了,对入门的读者是很大的提升

2018-04-22

简明Python教程

简明Python教程,讲解了Python2编程的各个方面,虽然论述和代码实例都很简洁,但是讲解清晰,是不错的入门书籍

2018-04-22

笨办法学Python

这本书是《笨办法学Python》,是第四版,作者通过52道习题,让我们掌握一定的Python编程知识和经验。虽然其涉及的领域相比于Python的应用来说很窄,但是作为入门的书籍来说很不错了

2018-04-22

CSDN电脑上读不了电子书?

发表于 2020-10-27 最后回复 2020-10-27

CSDN在电脑上读不了电子书?

发表于 2020-10-27 最后回复 2020-10-27

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人 TA的粉丝

提示
确定要删除当前文章?
取消 删除