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

自由软件给我自由!

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

原创 LeetCode C++ 剑指 Offer 09. 用两个栈实现队列【栈】

用两个栈实现一个队列。队列的声明如下,请实现它的两个函数 appendTail 和 deleteHead ,分别完成在队列尾部插入整数和在队列头部删除整数的功能。(若队列中没有元素,deleteHead 操作返回 -1 )示例 1:输入:["CQueue","appendTail","deleteHead","deleteHead"][[],[3],[],[]]输出:[null,null,3,-1]示例 2:输入:["CQueue","deleteHead","appendTail","a

2020-06-30 00:31:43 283

原创 LeetCode C++ 215. Kth Largest Element in an Array【堆/分治】中等

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.Example 1:Input: [3,2,1,5,6,4] and k = 2Output: 5Example 2:Input: [3,2,3,1,2,4,5,5,6] and k = 4Output: 4No

2020-06-29 14:33:37 287

原创 LeetCode C++ 1186. Maximum Subarray Sum with One Deletion【动态规划】中等

Given an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, you want to choose a subarray and optionally delete one element from it so that there is still at least one

2020-06-28 23:43:43 436

原创 LeetCode C++ 53. Maximum Subarray【动态规划】简单

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Explanation: [4,-1,2,1] has the largest sum = 6.Follow up: If you

2020-06-28 22:20:03 634

原创 LeetCode C++ 63. Unique Paths II【动态规划】中等

A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the dia

2020-06-28 17:15:09 197

原创 LeetCode C++ 64. Minimum Path Sum【动态规划】中等

Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at any point in time.Example:Input:[ [1,3,1], [1,5,1],

2020-06-28 16:26:22 165

原创 LeetCode 62. Unique Paths【动态规划;数学,排列组合】中等

A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the dia

2020-06-28 16:11:20 370 1

原创 LeetCode C++ 1232. Check If It Is a Straight Line 【Geometry/Math】简单

You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane.Example 1:Input: coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]]Output: true

2020-06-28 14:49:56 233

原创 LeetCode C++ 633. Sum of Square Numbers【Math】简单

Given a non-negative integer c, your task is to decide whether there’re two integers a and b such that a2+b2=ca^2 + b^2 = ca2+b2=c.Example 1:Input: 5Output: TrueExplanation: 1 * 1 + 2 * 2 = 5Example 2:Input: 3Output: False题意:给出一个非负整数 c ,判断是否存在整数

2020-06-28 14:31:46 258

原创 LeetCode C++ 41. First Missing Positive【Array】困难

Given an unsorted integer array, find the smallest missing positive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example 3:Input: [7,8,9,11,12]Output: 1Note: Your algorithm should run in O(n) time and uses const

2020-06-28 01:54:40 202

原创 LeetCode 389. Find the Difference【哈希表/位运算】简单

Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was added in t.Example:Input:s = "abcd"t = "abcde"Output:e

2020-06-27 22:08:57 246

原创 LeetCode 136. Single Number【哈希表/位运算/数学】简单

Given a non-empty array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?Example 1:Input: [2,2,1]Output: 1Exa

2020-06-27 22:01:44 214

原创 LeetCode 268. Missing Number【哈希表/数学/位操作】简单

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n , find the one that is missing from the array.Example 1:Input: [3,0,1]Output: 2Example 2:Input: [9,6,4,2,3,5,7,0,1]Output: 8Note: Your algorithm should run in linear runtime c

2020-06-27 21:55:20 306

原创 LeetCode C++ 11. Container With Most Water【双指针】中等

Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0) . Find two lines, which together with x-axis forms a container, s

2020-06-27 20:24:51 193

原创 LeetCode C++ 209. Minimum Size Subarray Sum【二分/滑窗/双指针】中等

Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn’t one, return 0 instead.Example:Input: s = 7, nums = [2,3,1,2,4,3]Output: 2Explanation: the subarray [4,

2020-06-27 16:08:27 221

原创 LeetCode C++ 面试题 02.01. Remove Duplicate Node LCCI【Linked List】简单

Write code to remove duplicates from an unsorted linked list.Example1: Input: [1, 2, 3, 3, 2, 1] Output: [1, 2, 3]Example2: Input: [1, 1, 1, 1, 2] Output: [1, 2]Note:The length of the list is within the range [0, 20000].The values of the list e

2020-06-26 14:56:35 228

原创 LeetCode C++ 239. Sliding Window Maximum【Monotonic Queue】困难

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 numbers in the window. Each time the sliding window moves right by one position. Return the max sliding windo

2020-06-26 01:25:47 263

原创 LeetCode C++ 139. Word Break【Dynamic Programming】中等

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.Note:The same word in the dictionary may be reused multiple times

2020-06-25 23:56:24 243

原创 LeetCode C++ 155. Min Stack【Stack】简单

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get the top element.getMin() – Retrieve the minimum element in

2020-06-25 00:51:21 240

原创 【算法学习】位运算专题 奇妙位操作总结2

文章目录1. 高效判断一个数是否是3的倍数 Check if a integer is multiple of 3 efficently(1) 题意(2) 思路(3) 模板代码2. 快速乘7 Efficient method to Multiply with 7(1) 题意(2) 思路(3) 模板代码前一篇:【算法学习】Bit Algorithms总结11. 高效判断一个数是否是3的倍数 Check if a integer is multiple of 3 efficently(1) 题意写一个函

2020-06-24 14:54:59 627

原创 LeetCode C++ 67. Add Binary【Math/String】简单

Given two binary strings, return their sum (also a binary string).The input strings are both non-empty and contains only characters 1 or 0.Example 1:Input: a = "11", b = "1"Output: "100"Example 2:Input: a = "1010", b = "1011"Output: "10101"Constr

2020-06-24 01:01:15 216

原创 【微机原理与接口技术】学习笔记8 串行通信和8250芯片

本章主要内容:§9.1 串行通信的基本概念和EIA RS-232C串行口并行通信计算机与外部的信息交换称为通信,基本的通信方式有两种:并行通信,串行通信。并行通信时,数据各位同时传送。例如,CPU通过8255A与外设交换数据时,就采用并行通信方式。这种方式传输数据的速度快,但使用的通信线多,如果要并行传送8位数据,需要用8根数据线,另外还要加上一些控制信号线。随着传输距离的增加,通信线成本增加将成为突出的问题,而且传输的可靠性随着距离的增加而下降。 因此并行通信适用于近距离传送数据的场合。串行通

2020-06-20 16:55:14 7219

原创 LeetCode C++ 10. Regular Expression Matching【String】困难

Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The matching should cover the entire input string (not pa

2020-06-20 13:39:34 182

原创 【微机原理与接口技术】学习笔记9 DMA控制器8237A

本章主要内容:11.1 8237A 的组成与工作原理DMA传送用DMA方式传送数据时,传送过程完全由DMA控制器(DMAC)控制。其基本功能:DMAC能向CPU的HOLD脚发出DMA请求信号。CPU响应DMA请求后,DMAC获得总线控制权,由它控制数据的传送,CPU则暂停工作。能提供读/写存储器或I/O设备的各种控制命令。确定数据传输的始址和数据长度,每传送1个数据便自动修改地址(+1或-1),数据长度-1。传送完毕,能发出结束DMA传送的信号。CPU在每个非锁定时钟周期结束后,都会检测

2020-06-20 02:09:46 7746

原创 LeetCode C++ 125. Valid Palindrome【String】简单

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.Note: For the purpose of this problem, we define empty string as valid palindrome.Example 1:Input: "A man, a plan, a canal: Panama"Output: true

2020-06-19 23:42:16 192

原创 【微机原理与接口技术】学习笔记7 中断和可编程中断控制器8259A

文章目录§8.1 中断8.1.1 中断概念和分类1.中断的定义和功能2.中断源和中断分类8.1.2 中断的响应与处理过程1.中断响应过程2.8086的中断响应与处理§8.2 8259A的工作原理8.2.1 8259A的引脚信号和内部结构8.2.2 8259A的工作方式1.设置优先级方式2.中断屏蔽方式3.结束中断方式4.中断查询方式-POLL8.2.3 8259A的命令字及编程为使8259A按预定方式工作,必须对它编程,由CPU向其控制寄存器发各种控制命令。§8.3 8259A应用举例本章

2020-06-19 00:15:27 5097

原创 东方Project题目 1975 红魔馆爆炸了

这是湖南科技大学OJ中的一道题目,因为在刷贴吧的时候看到了,所以就做了。题目描述红魔馆最近迎来了两块陨石,由于防范不到位,第一块陨石从天而降,红魔馆爆炸了。馆主蕾米莉亚有着强大的力量,她决定阻止第二块陨石,方法是将陨石打爆,使其分裂成若干个小石块。为了简化问题,我们可以将一块陨石看作由连续的 n 个石块组成,每个石块包含了一定能量,蕾米莉亚需要毁掉其中某一段连续的石块(该段能量和为 s ),被毁掉的石块将会消失,且因连锁反应还会使剩余石块总能量减少 s ,蕾米莉亚需要保证剩余石块总能量不大于 m ,

2020-06-18 21:53:47 867 1

原创 LeetCode 224. Basic Calculator 【Stack】困难

Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty spaces .Example 1:Input: "1 + 1"Output: 2Example 2:In

2020-06-18 01:27:38 174

原创 【微机原理与接口技术】学习笔记5 I/O接口和并行接口芯片8255A

第6章I/O接口和并行接口芯片8255A本章主要内容:§6.1 I/O接口6.1.1 I/O接口的功能1. 采用I/O接口的必要性计算机与外设之间交换数据、状态和控制命令的过程统称为通信(Communication)。CPU与外设交换信息的过程,和它与存储器交换数据那样,也是在控制信号的作用下通过数据总线来完成的。存储器芯片的存取速度与CPU的时钟频率在同一数量级,存储器本身又具有数据缓冲能力,所以CPU与存储器可以很方便地交换数据,但与外设交换数据的过程要复杂得多。计算机与外设间的信

2020-06-17 16:48:39 5155

原创 LeetCode C++ 537. Complex Number Multiplication【Math】中等

Given two strings representing two complex numbers.You need to return a string representing their multiplication. Note i2=−1i^2 = -1i2=−1 according to the definition.Example 1:Input: "1+1i", "1+1i"Output: "0+2i"Explanation: (1 + i) * (1 + i) = 1 + i2

2020-06-16 23:50:25 198

原创 LeetCode C++ 449. Serialize and Deserialize BST【Binary-search 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 buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer env

2020-06-16 20:56:07 248

原创 LeetCode C++ 297. Serialize and Deserialize Binary Tree【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 buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer env

2020-06-16 20:52:55 253

原创 洛谷 P4779 【模板】单源最短路径(标准版)

题目背景2018 年 7 月 19 日,某位同学在 NOI Day 1 T1 归程 一题里非常熟练地使用了一个广为人知的算法求最短路。然后呢?100→60;Ag→Cu;最终,他因此没能与理想的大学达成契约。小 F 衷心祝愿大家不再重蹈覆辙。题目描述给定一个 nnn 个点,mmm 条有向边的带非负权图,请你计算从 sss 出发,到每个点的距离。数据保证你能从 sss 出发到任意点。输入格式第一行为三个正整数 n,m,sn,m,sn,m,s 。 第二行起 mmm 行,每行三个非负整数 ui,

2020-06-16 01:19:30 345

原创 洛谷 P3371 【模板】单源最短路径(弱化版)

题目背景本题测试数据为随机数据,在考试中可能会出现构造数据让 SPFA 不通过,如有需要请移步 P4779 。题目描述如题,给出一个有向图,请输出从某一点出发到所有点的最短路径长度。输入格式第一行包含三个整数 n,m,sn,m,sn,m,s,分别表示点的个数、有向边的个数、出发点的编号。接下来 mmm 行每行包含三个整数 u,v,wu,v,wu,v,w,表示一条 u→vu \to vu→v 的,长度为 www 的边。输出格式输出一行 nnn 个整数,第 iii 个表示 sss 到第 iii

2020-06-15 21:59:35 347

原创 【微机原理与接口技术】学习笔记2 8086CPU

文章目录8.1.1 8086 CPU内部结构及工作过程第2章 8086 CPU本章主要内容§2.1 8086 CPU的内部结构 (内部组成、寄存器结构) §2.2 8086/8088 CPU的引脚功能(引脚特性和作用) §2.3 8086的存储器组织 §2.4 8086的工作模式和总线操作8086CPU的基本性能指标(1)16位微处理器;(2)采用高速运算性能的HMOS工艺制造,芯片上集成了2.9万只晶体管;(3)使用单一的+5V电源,40条引脚双列直插式封装;(4)时钟频率为

2020-06-15 12:45:01 2672

原创 【算法学习】位运算专题 奇妙位操作总结1

文章目录1. 无算术运算符的加法 Add two numbers without using arithmetic operators(1) 题意(2) 思路(3) 模板代码(3) 习题位操作有太多的神奇写法,这里总结一部分。1. 无算术运算符的加法 Add two numbers without using arithmetic operators(1) 题意如果有一个题目,要求我们实现一个 add 函数,不使用包括 +,++,-,--,.. 等算术运算符,完成两个整型数的相加。两个比特的相加,

2020-06-15 00:43:00 705

原创 【微机原理与接口技术】学习笔记1 微型计算机的结构系统和发展概况

文章目录§1.1 计算机中数的表示方法 1.1.1 进位计数制(略)1.1.2 二进制编码1.1.3 带符号数的表示方法符号表示最高位做符号位对于长度8位的数(D7~D0),用D7位作符号位,D7=1表示负数,D7=0表示正数。例1.4 0101 1101B = +931101 1101B = −93对于长度16位的数(D15~D0),D15=1表示负数,D15=0表示正数。带符号位的数称为机器数,它表示的实际数值称为机器数的真值。原码、反码和补码为运算方便,机器数可

2020-06-14 22:02:01 1305

原创 POJ 1001 A+B Problem 水题

DescriptionCalculate a+b.InputTwo integer a,b (0<=a,b<=10)OutputOutput a+b.Sample Input1 2Sample Output3题目:A+B。思路一 直接加直接用加法。#include <iostream>using namespace std;int main() { int a, b; cin >> a >> b; c

2020-06-14 20:39:42 222

原创 LeetCode 38. Count and Say【字符串/迭代/递归/模拟/打表】简单

The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as “one 1” or 11.11 is read off as “two 1s” or 21.21 is read off as "one 2", then "one 1"

2020-06-13 01:30:16 299

原创 洛谷 P3958 奶酪【并查集】

题目描述现有一块大奶酪,它的高度为 hhh,它的长度和宽度我们可以认为是无限大的,奶酪 中间有许多 半径相同 的球形空洞。我们可以在这块奶酪中建立空间坐标系,在坐标系中, 奶酪的下表面为 z=0z=0z=0 ,奶酪的上表面为 z=hz=hz=h 。现在,奶酪的下表面有一只小老鼠 Jerry,它知道奶酪中所有空洞的球心所在的坐 标。如果两个空洞相切或是相交,则 Jerry 可以从其中一个空洞跑到另一个空洞,特别地,如果一个空洞与下表面相切或是相交,Jerry 则可以从奶酪下表面跑进空洞;如果一个空洞与上表

2020-06-10 13:29:11 402

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

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

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

空空如也

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

TA关注的人

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