自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(66)
  • 收藏
  • 关注

原创 [ LeetCode ] #25. Reverse Nodes in k-Group(翻转相邻的k个元素)

题目:25. Reverse Nodes in k-GroupGiven a linked list, reverse the nodes of a linked listkat a time and return its modified list.kis a positive integer and is less than or equal to the length of t...

2019-03-01 20:18:15 171

原创 [ LeetCode ] #17. Letter Combinations of a Phone Number(电话按键组合字符 C++ & Python)

题目:17. Letter Combinations of a Phone NumberDifficulty: MediumGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mappi...

2019-02-24 11:18:02 201

原创 [ LeetCode ] #8. String to Integer (atoi)(C++ & Python)

题目:8. String to Integer (atoi)Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character i...

2019-02-19 22:04:06 102

原创 [ LeetCode ] 5. Longest Palindromic Substring (C++ & Python)

题目:5. Longest Palindromic SubstringGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad"Output: "bab"No...

2019-02-19 10:44:08 300

原创 [ LeetCode ] 4. Median of Two Sorted Arrays (C++ & Python)

题目:4. Median of Two Sorted ArraysThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log ...

2019-02-18 13:47:32 160

原创 [ LeetCode ] #3. Longest Substring Without Repeating Characters (C++ & Python)

题目:3. Longest Substring Without Repeating Characters 题目连接 题目描述:Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Exp...

2019-02-16 20:48:38 117

原创 [ Leetcode ] #43 Multiply Strings(C++ & Python3)

题目:Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.Example 1:Input: num1 = "2", num2 = "3"Output: "6"E...

2019-02-16 16:42:44 159

原创 [ Leetcode ] #2. Add Two Numbers(C++ & Python)

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return i...

2019-01-30 21:53:38 136

原创 Linux常用命令

ls 命令 ls(list files),用于显示指定目录下的内容(列出当前目录下的文件和子目录) 查看官方文档,man ls参数: -1 强制输出每项单独占一行 -A 显示当前目录包含的所有文件和子目录(. 和 .. 除外). -a显示当前目录包含的所有文件和子目录. -G显示当前目录包含的内容时用颜色加以区分 -l显示当前目录包含的内容的详细信息 -R递归显示所有子目录的内容. -r ...

2020-10-28 10:42:27 175

原创 TCP的拥塞控制机制

TCP通过一个定时器采样了RTT并计算RTO,但是,如果网络上的延时突然增加,那么,TCP对这个事做出的应对只有重传数据;而重传数据又会导致网络的负担更重,于是会导致更大的网络延迟以及更多的丢包,这就导致了恶性循环,最终形成”网络风暴“, 而TCP拥塞控制机制就是用于应对这种情况。为了在发送端调节所要发送的数据量,定义了一个”拥塞窗口“ 在发送数据时,将拥塞窗口的大小与接收端ack的窗口大小做比较,取较小者作为发送数据量的上限。发送方维护一个叫做拥塞窗口cwnd的状态变量,其值取决于网络拥塞的拥塞程

2020-08-16 13:55:34 485

原创 【秋招】操作系统进程调度算法

FCFS先来先服务: 最简单 每次从就绪队列中选择一个最先进入该队列的进程(队头),分配处理机直至运行完成或阻塞(不可剥夺的方式) 表面上公平,但是当长作业到达时,会使得短作业长时间等待 常常作为一种辅助策略和其他策略配合使用 不利于I/O繁忙的作业。 RR时间片轮转:最公平 主要用于进程调度,且常用于分时系统。 通常,操作系统将所有的就绪进程按照FCFS的方式排列成一个队列,每次调度的时候,把CPU分配给对首的进程,并执行一个时间片,如果在所分配的时间片内运行完成,则弹出队列;

2020-07-11 15:21:25 288

原创 Linux进程间通信解析

什么是进程?1. 进程是指程序的一次执行过程,同一个程序,每次执行均为不同的进程。2. 进程是系统资源分配的最小单位。进程间通信的目的操作系统往往会为每一个进程开辟一个独立的虚拟内存空间,从而使得进程间可以各司其职、互不干扰。但是在一些稍微复杂点业务场景中,往往又需要进程之间相互配合,进行资源共享、数据传输、信号传递的操作,因此需要一定的手段来帮助我们实现进程间通信。进程间通信...

2020-03-01 18:41:20 254

原创 TCP的三次握手

TCP连接建立是一个不对称的过程,也就是TCP连接的两方中一方处于被动方式(UNIX下调用listen),一方处于主动方式(调用connect)。主动方式的客户端要求和被动方式的服务端建立一条传输连接,这是通过一系列的消息交换而进行的,连接建立好后是全双工的,任何一方都可以开始传输数据。三次握手连接的过程如下图:连接过程:client发送一个特殊的TCP报文段(一般称为SYN段)给...

2020-02-22 17:16:48 161

原创 [ LeetCode ] 837. New 21 Game(新21点游戏)

Alice plays the following game, loosely based on the card game "21".Alice starts with0points, and draws numbers while she has less thanKpoints. During each draw, she gains an integer number of ...

2019-09-23 15:51:35 209

原创 【第十二章】Custom widgets in PyQt5(自定义部件)

PyQt5具有大量的部件。然而,并没有什么工具包能够满足开发者在开发应用程序时的所有需求。工具包一般只提供会常用到的组件,比如按钮、文本部件或是滑块。如果需要更专业的小部件,我们必须自己来创建。自定义部件由工具包提供的绘画工具来创建。它有两种可能:开发人员可以修改或增强现有小部件,也可以从头开始创建自定义的小部件。Burning widget以下示例为我们可以在Nero、K3B或其他C...

2019-09-11 15:48:24 498

原创 【第十一章】Painting in PyQt5(绘画)

PyQt5绘画系统能够渲染矢量图形、图像和轮廓基于字体的文本。当我们在应用程序中想要改变或是提高现存的部件或者如果我们要创建一个自定义的部件时往往需要用到绘画。为了使用绘画我们可以使用PyQt5提供的绘画API。QPainterQPainter对小部件和其他绘图设备执行低级别的绘制,它可以绘制从简单线条到复杂形状的所有内容。The paintEvent method通过使用pa...

2019-09-11 15:02:52 315

原创 【第十章】Drag and drop in PyQt5(拖放)

本篇主要介绍PyQt5中拖放的操作。在计算机图形用户界面中,拖放指单击虚拟对象并将其拖动到其他位置或另一个虚拟对象的动作。通常情况下,它可以用来调用多种动作或者在两个抽象对象之间创建各种类型的关联。拖放是用户图形界面的一部分,拖拽可以使用户更加直观地执行复杂操作。通常我们可以拖放两件事:数据或一些图形对象。如果我们从一个应用程序拖动一张图片到另一个程序,我拖放的即为二进制数据。如果我们...

2019-09-10 20:34:21 517

原创 【第九章】PyQt5 widgets II

这一章将继续介绍PyQt5中的一些部件:QPixmap、QLineEdit、QSplitter和QComboxBoxQPixmapQPixmap是用来显示图片的部件,它针对在屏幕上显示图像进行了优化。在以下示例中,我们将使用QPixmap在窗口上显示图像。import sysfrom PyQt5.QtGui import QPixmapfrom PyQt5.QtWidgets i...

2019-09-10 14:27:11 162

原创 【第八章】PyQt5 widgets(pyqt5 部件)

部件是一个应用程序的基本组件块。PyQt5具有大量的组件,包含按钮、选择框、滑块或列表盒子等。本章则主要介绍一些常用的组件:QCheckBox、tooggle模式下的QPushButton、QSlider、QProgressBar和QCalendarWidget。QCheckBoxQCheckBox具有两种状态的部件:打开和关闭。这是一个带有标签的盒子,复选框通常用于表示可以启用或禁用的应...

2019-09-09 22:37:59 661

原创 【第七章】Dialogs in PyQt5(对话框)

对话框窗口或对话框是大多数现代GUI应用程序中不可或缺的一部分。对话框被定义为两个或更多人之间的对话。在计算机应用程序中,对话框是用于与应用程序“对话”的窗口。对话框可用于输入数据、更改数据及修改应用程序的设定等。QInputDialogQInputDialog提供了一个简单便捷的对话框,用于从用户获取单个值。输入值可以是字符串、数值或一个列表中的项目。import sysfrom...

2019-09-09 18:24:31 187

原创 【第六章】Events and signals in PyQt5(事件与信号)

本文我们主要介绍pyqt5中的事件与信号的应用。EventsGUI应用程序是由事件驱动的,而事件则主要是由应用程序的用户产生的,但也可以通过其他方式产生,比如通过网络连接、窗口管理或计时器等。当我们调用应用程序的exec_()方法时,应用程序会进入主循环,这个主循环会捕获事件并把它发送给相应的对象。在事件模块中,由以下三个部分组成:事件源 事件对象 事件目标事件源是指状态改变...

2019-09-09 11:09:25 227

原创 【第五章】Layout management in PyQt5(布局管理)

布局管理就是我们如何在应用程序窗口上放置小部件。我们可以使用绝对定位或布局类来放置小部件。使用布局管理器管理布局是组织窗口小部件的首选方式。Absolute positioning由开发人员指定每一个小部件的位置和大小,当我们使用绝对布局的时候,必须了解以下限制。当改变应用程序窗口大小时,小部件的位置和大小不发生任何变化 应用程序界面在不同的平台下看上去可能不一样 更改应用程序中的...

2019-09-08 09:35:37 145

原创 【第四章】Menus and toolbars in PyQt5(菜单和工具栏)

这一部分 我们将介绍状态栏、菜单栏和一个工具栏,菜单是一组位于菜单栏的命令。工具栏上的按钮包含应用程序中的一些常用命令,状态栏显示状态信息,通常位于应用程序窗口的底部。QMainWindowQMainWindow类提供了一个主应用程序窗口,这样可以创建一个带有状态栏、工具栏和菜单栏的经典应用程序框架。Statusbar状态栏是用于显示状态信息的小组件。import sysf...

2019-09-06 16:49:02 436

原创 [第三章] 第一个PyQt5程序

在PyQt5教程的这一部分中,我们将学会一些基本功能的使用,以下实例为 显示工具提示和图标、关闭窗口、显示消息框并在桌面上居中显示窗口。Simple Example以下示例展示了一个简单的窗口。然而 我们可以用这个窗口做很多的事情,比如调整大小、最大化、最小化等,但这需要大量的代码。由于这些东西在很多应用程序中都需要用到,所以一些大佬实现并封装好了这些代码,因此当我们需要使用的相应的功能的...

2019-09-05 22:49:59 379

原创 【第二章】PyQt5 data和time模块

date and time这部分将介绍PyQt5如何使用日期和时间模块。QDate、QTime、DateTimePyQt5具有QDate、QDateTime、QTime这几个类用于处理时间和日期问题。QDate类用于解决日历日期的问题,它包含了指定、比较和修改日期的方法。QTime类使用时钟时间,它提供了比较时间、确定时间和各种其他时间操纵的方法。QDateTime是一个将...

2019-09-05 21:03:38 1641

原创 【第一章】PyQt5介绍

本系列教程翻译自http://zetcode.com/gui/pyqt5/introduction/,由于水平有限,难免会有疏漏,欢迎大家给予批评指正。本教程旨在帮助大家学习如何使用PyQt5,本教程所有实例均在Linux下测试通过。关于PyQt5PyQt5是一套Python绑定Digia Qt5的应用框架。可应用与python2.x及python3.x。本教程选用python3...

2019-09-05 19:07:48 2665

原创 梯度下降(Gradient Descent)总结

1. 梯度 在微积分中,梯度的概念是:对多元函数的参数求∂偏导数,把求得的各个参数的偏导数以向量的形式写出来。比如函数f(x,y), 分别对x,y 求偏导数,求得的梯度向量就是(∂f/∂x,∂f/∂y)T,简称grad f(x,y)或者▽f(x,y)。 对于在点(x0,y0) 的具体梯度向量就是(∂f/∂x0,∂f/∂y0)T.或者▽f(x0,y0),如果包含3个参数的向量梯度,就是...

2019-08-28 20:05:41 451

原创 [ LeetCode ] #316. Remove Duplicate Letters(移除重复出现的字符)

题目:316. Remove Duplicate LettersGiven a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the s...

2019-04-25 11:23:19 252

原创 [ LeetCode ] #49. Group Anagrams( 组Anagrams C++ & Python )

题目:49. Group AnagramsGiven an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat","tan"], ["bat"]]...

2019-04-09 13:50:52 241

原创 [ LeetCode ] #45. Jump Game II( 跳跃比赛II ) C++ & Python

题目:45. Jump Game IIGiven 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 posit...

2019-03-28 11:15:40 380

原创 [ LeetCode ]#44. Wildcard Matching(通配符匹配)

题目:44. Wildcard MatchingGiven an input string (s) and a pattern (p), implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of...

2019-03-26 20:05:10 110

原创 [ LeetCode ] #42. Trapping Rain Water(雨水储量 C++ & Python)

题目:42. Trapping Rain WaterGivennnon-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.The above elevatio...

2019-03-23 10:17:59 168

原创 [ LeetCode ]#41. First Missing Positive(找到丢失的最小正整数 C++ & Python)

题目:41. First Missing PositiveGiven an unsorted integer array, find the smallest missingpositive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example ...

2019-03-22 11:32:56 335

原创 [ LeetCode ] #40. Combination Sum II(数列组合2)

题目:40. Combination Sum IIGiven a collection of candidate numbers (candidates) and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Ea...

2019-03-21 10:54:26 101

原创 [ LeetCode ]#39. Combination Sum(组合求和C++ & Python)

题目:39. Combination SumGiven asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums to...

2019-03-18 12:18:39 172

原创 [ LeetCode ] #79. Word Search(查找单词)

题目:79. Word SearchGiven a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizont...

2019-03-17 15:34:30 181

原创 [ 滴滴笔试题 ]# 几个岛

题目时间限制:1秒空间限制:65536K给定一个m行n列的二维地图, 初始化每个单元都是水.操作addLand 把单元格(row,col)变成陆地.岛屿定义为一系列相连的被水单元包围的陆地单元, 横向或纵向相邻的陆地称为相连(斜对角不算).在一系列addLand的操作过程中, 给出每次addLand操作后岛屿的个数.二维地图的每条边界外侧假定都是水.输入描述:...

2019-03-14 11:04:30 517

原创 [ 滴滴笔试题 ] # 幂运算

题目:https://www.nowcoder.com/question/next?pid=12029438&qid=225676&tid=22097088时间限制:1秒空间限制:131072K给定两个数R和n,输出R的n次方,其中0.0<R<99.999, 0<n<=25输入描述:多组测试用例,请参考例题的输入处理 输入每行一个...

2019-03-14 10:47:23 388

原创 [ LeetCode ] #36. Valid Sudoku(有效的数独)

题目:36. Valid SudokuDetermine if a9x9 Sudoku boardis valid.Only the filled cells need to be validatedaccording to the following rules:Each rowmust contain thedigits1-9without repetition. E...

2019-03-12 13:09:25 134

原创 [LeetCode] #1004. Max Consecutive Ones III(最大连续1的个数 C++&Python)

题目:1004. Max Consecutive Ones IIIGiven an arrayAof 0s and 1s, we may change up toKvalues from 0 to 1.Return the length of the longest (contiguous) subarray that contains only 1s.Example ...

2019-03-11 10:44:08 247

空空如也

空空如也

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

TA关注的人

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