自定义博客皮肤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的博客

自由软件给我自由!

  • 博客(90)
  • 资源 (8)
  • 收藏
  • 关注

原创 LeetCode C++ 696. Count Binary Substrings【String】简单

Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0’s and 1’s, and all the 0’s and all the 1’s in these substrings are grouped consecutively.Substrings that occur multiple times are counted the number of t

2020-10-29 14:06:59 174

原创 LeetCode 434. Number of Segments in a String【字符串/模拟】简单

You are given a string s, return the number of segments in the string.A segment is defined to be a contiguous sequence of non-space characters.Example 1:Input: s = "Hello, my name is John"Output: 5Explanation: The five segments are ["Hello,", "my", "n

2020-10-29 01:29:30 182

原创 LeetCode 367. Valid Perfect Square【数学/二分】简单

Given a positive integer num, write a function which returns True if num is a perfect square else False.Follow up: Do not use any built-in library function such as sqrt.Example 1:Input: num = 16Output: trueExample 2:Input: num = 14Output: falseCo

2020-10-29 01:14:24 161

原创 LeetCode 371. Sum of Two Integers【递归/迭代/位运算】中等

Calculate the sum of two integers a and b , but you are not allowed to use the operator + and - .Example 1:Input: a = 1, b = 2Output: 3Example 2:Input: a = -2, b = 3Output: 1题意:不使用运算符 + 和 - ​​​​​​​,计算两整数 ​​a 、b ​​​​​​​之和。解法1 递归做过的题目:class Solu

2020-10-29 01:02:02 173

原创 LeetCode 292. Nim 游戏【博弈论,脑筋急转弯】简单

You are playing the following Nim Game with your friend:Initially, there is a heap of stones on the table.You and your friend will alternate taking turns, and you go first.On each turn, the person whose turn it is will remove 1 to 3 stones from the hea

2020-10-29 00:44:54 227

原创 【算法学习】二叉树专题 线索二叉树

线索二叉树的创建和遍历,先放代码,日后讲解:#include <iostream>#include <cstring>using namespace std;typedef char ElemType;#define MAX 100typedef enum { Link, Thread } PointerTag; //标签,Link=0表示指针;Thread=1表示线索 /*构建链表结构二叉树结点*/class BiTree{public: ElemType

2020-10-28 23:38:18 481

原创 【算法学习】图论专题 关键路径

以后详细解释,先把代码放上来:#include <iostream>#include <initializer_list>#include <cstdio> #include <algorithm>#include <vector>using namespace std;/*** 编制一个算法程序, 求AOE网的关键路径,** 可以自己构造数据或使用P266页图7.36数据测试。P266页图7.36数据: A B 6A

2020-10-28 23:35:00 186

原创 LeetCode C++ 329. Longest Increasing Path in a Matrix【Memoization/Dynamic Programming】困难

Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outside of the boundary (i.e. wrap-around is not allowed).Example

2020-10-28 17:04:38 169

原创 LeetCode 337. House Robber III【DFS,树型DP】中等

The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.” Besides the root, each house has one and only one parent house. After a tour, the smart thief realized that “all houses in this plac

2020-10-28 15:10:56 157

原创 LeetCode 213. House Robber II【动态规划(环形)】简单

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in a circle. That means the first house is the neighbor of the last one. Meanwhile, adjacent houses

2020-10-28 14:53:48 204

原创 LeetCode C++ 383. Ransom Note【String/Hash Table】简单

Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines ; otherwise, it will return false.Each letter in the magazi

2020-10-28 13:33:49 196

原创 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 houses have security system connected and it will automatical

2020-10-28 01:30:31 211

原创 LeetCode C++ 面试题 17.16. The Masseuse LCCI【Dynamic Programming】简单

A popular masseuse receives a sequence of back-to-back appointment requests and is debating which ones to accept. She needs a break between appointments and therefore she cannot accept any adjacent requests. Given a sequence of back-to-back appoint­ ment r

2020-10-28 01:16:13 403

原创 LeetCode C++ 1207. Unique Number of Occurrences【Hash Table】简单

Given an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique.Example 1:Input: arr = [1,2,2,1,1,3]Output: trueExplanation: The value 1 has 3 occurrences, 2 has 2 and 3 h

2020-10-28 00:58:20 148

原创 LeetCode C++ 面试题 17.01. Add Without Plus LCCI【Bit Manipulation】简单

Write a function that adds two numbers. You should not use + or any arithmetic operators.Example:Input: a = 1, b = 1Output: 2Note:a and b may be 0 or negative.The result fits in 32-bit integer.题意:设计一个函数把两个数字相加。不得使用 + 或者其他算术运算符。注意,a, b 均可能是负数或 0 ,

2020-10-28 00:43:07 146

原创 LeetCode C++ 面试题 16.15. Master Mind LCCI【Hash Table】简单

The Game of Master Mind is played as follows:The computer has four slots, and each slot will contain a ball that is red ®. yellow (Y). green (G) or blue (B). For example, the computer might have RGGB (Slot #1 is red, Slots #2 and #3 are green, Slot #4 is

2020-10-28 00:06:31 229

原创 【PAT甲级】1003 Emergency (25分)

As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the length of each road between any pair of cities are marked

2020-10-27 16:07:35 54

原创 LeetCode C++ 1365. How Many Numbers Are Smaller Than the Current Number【排序/前缀和】简单

Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i] . Return the answer in an array.Example 1:Inp

2020-10-26 19:59:28 161

原创 LeetCode C++ 845. Longest Mountain in Array【Two Pointers】中等

Let’s call any (contiguous) subarray B (of A) a mountain if the following properties hold:B.length >= 3There exists some 0 < i < B.length - 1 such that B[0] < B[1] < ... B[i-1] < B[i] > B[i+1] > ... > B[B.length - 1](Note th

2020-10-25 10:07:39 155

原创 LeetCode C++ 1024. Video Stitching【Greedy/Dynamic Programming】中等

You are given a series of video clips from a sporting event that lasted T seconds. These video clips can be overlapping with each other and have varied lengths.Each video clip clips[i] is an interval: it starts at time clips[i][0] and ends at time clips[

2020-10-24 12:07:42 177

原创 LeetCode C++ 1022. Sum of Root To Leaf Binary Numbers【Tree】简单

You are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit. For example, if the path is 0 -> 1 -> 1 -> 0 -> 1, then this could represent

2020-10-24 10:54:20 171

原创 LeetCode C++ 1021. Remove Outermost Parentheses【Stack】简单

A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string concatenation. For example, "", "()", "(())()", and "(()(()))" are all valid parentheses strings.A valid parent

2020-10-24 09:56:26 181

原创 LeetCode C++ 938. Range Sum of BST【Tree/Recursion】简单

Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive).The binary search tree is guaranteed to have unique values.Example 1:Input: root = [10,5,15,3,7,null,18], L = 7, R = 15Output: 32

2020-10-23 21:41:18 138

原创 LeetCode C++ 942. DI String Match【Greedy】简单

Given a string S that only contains "I" (increase) or "D" (decrease), let N = S.length .Return any permutation A of [0, 1, ..., N] such that for all i = 0, ..., N-1 :If S[i] == "I" , then A[i] < A[i+1]If S[i] == "D" , then A[i] > A[i+1]Example

2020-10-23 18:54:56 145

原创 LeetCode C++ 941. Valid Mountain Array【Array/Two Pointers】简单

Given an array A of integers, return true if and only if it is a valid mountain array.Recall that A is a mountain array if and only if:A.length >= 3There exists some i with 0 < i < A.length - 1 such that:A[0] < A[1] < ... A[i-1] < A

2020-10-23 18:38:29 142

原创 LeetCode C++ 460. LFU Cache【Design/Hash Table/Double LinkedList】困难

Design and implement a data structure for Least Frequently Used (LFU) cache .Implement the LFUCache class:LFUCache(int capacity) Initializes the object with the capacity of the data structure.int get(int key) Gets the value of the key if the key exists

2020-10-23 16:11:12 211

原创 LeetCode C++ 234. Palindrome Linked List【链表/双指针/递归】简单

Given a singly linked list, determine if it is a palindrome.Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: trueFollow up: Could you do it in O(n)O(n)O(n) time and O(1)O(1)O(1) space?题意:判断一个单链表是否是回文链表。解法1 复制链表值

2020-10-23 15:48:32 219

原创 LeetCode C++ 61. Rotate List【Linked List/Two Pointers】中等

Given a linked list, rotate the list to the right by k places, where k is non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1->2->3->NULLExplanation:rotate 1 steps to the right: 5->1->2->3-&gt

2020-10-22 20:29:27 148

原创 LeetCode C++ 153. Find Minimum in Rotated Sorted Array【Array/二分】中等

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2] ).Find the minimum element. You may assume no duplicate exists in the array.Example 1:Input: [3,4,5,1,2]

2020-10-22 19:15:41 170

原创 LeetCode C++ 55. Jump Game【Greedy】中等

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 you are able to reach the last index.Example 1:Input: nums

2020-10-22 18:48:13 126

原创 LeetCode C++ 763. Partition Labels【String/Greedy】中等

A string S of lowercase English letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representing the size of these parts.Example 1:Input: S = "ab

2020-10-22 15:57:45 155

原创 LeetCode C++ 263. Ugly Number【Math】简单

Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5.Example 1:Input: 6Output: trueExplanation: 6 = 2 × 3Example 2:Input: 8Output: trueExplanation: 8 = 2 × 2

2020-10-22 01:40:47 113

原创 LeetCode C++ 189. Rotate Array【Array】中等

Given an array, rotate the array to the right by k steps, where k is non-negative.Follow up:Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.Could you do it in-place with O(1) extra space?Example

2020-10-22 00:50:28 180

原创 LeetCode C++ 81. Search in Rotated Sorted Array II【数组/二分】中等

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,0,1,2,2,5,6] might become [2,5,6,0,0,1,2] ). You are given a target value to search. If found in the array return true , otherwise return false .Examp

2020-10-21 23:13:56 186

原创 LeetCode C++ 143. Reorder List【LinkedList/Deque】中等

Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You may not modify the values in the list's nodes, only nodes itself may be changed.Example 1:Given 1->2->3->4, reorder it to 1->4->2->3.Example 2:G

2020-10-21 22:01:33 216

原创 LeetCode C++ 33. Search in Rotated Sorted Array【二分】中等

You are given an integer array nums sorted in ascending order, and an integer target .Suppose that nums is rotated at some pivot unknown to you beforehand (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2] ).If target is found in the array return its in

2020-10-21 12:25:53 218

原创 LeetCode C++ 925. Long Pressed Name【String/Two Pointers】简单

Your friend is typing his name into a keyboard. Sometimes, when typing a character c , the key might get long pressed, and the character will be typed 1 or more times.You examine the typed characters of the keyboard. Return True if it is possible that i

2020-10-21 10:57:01 158

原创 LeetCode 119. Pascal‘s Triangle II【数学】简单

Given an integer rowIndex , return the rowIndexth row of the Pascal’s triangle. Notice that the row index starts from 0.In Pascal’s triangle, each number is the sum of the two numbers directly above it.Follow up: Could you optimize your algorithm to use

2020-10-21 01:02:14 208 1

原创 LeetCode 118. Pascal‘s Triangle【Array】简单

Given a non-negative integer numRows, generate the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it.Example:Input: 5Output:[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1

2020-10-21 00:35:43 163

原创 LeetCode 146. LRU Cache【设计,哈希表,双向链表】中等

Design a data structure that follows the constraints of a Least Recently Used (LRU) cache .Implement the LRUCache class:LRUCache(int capacity) Initialize the LRU cache with positive size capacity .int get(int key) Return the value of the key if the key

2020-10-20 22:41:34 295 1

西电软件工程概论考前复习题

西电软件工程概论考前复习题

2022-06-25

chapter1_7.zip

Orange's操作系统一书的相关资源,1-7章,个人在Ubuntu虚拟机上运行过

2021-07-15

rubyinstaller-devkit-3.0.1-1-x64.exe

官网下载太慢,这里是我分享的安装包

2021-06-30

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

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

2018-04-30

Coursera机器学习笔记

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

2018-04-22

Python编程

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

2018-04-22

简明Python教程

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

2018-04-22

笨办法学Python

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

2018-04-22

空空如也

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

TA关注的人

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