自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 素数、大素数的素性判定

素数判定/寻找的一些方法整理记录:仍在进行的基于全世界计算机的分布式计算寻找素数项目:

2023-05-30 15:06:03 653

原创 在线免费把Markdown格式文件转换为PDF格式

顶下去再预览打印会发现第一页是空白的,可以在打印的“页面选项”自定义要打印的页数翻范围,去掉第一页就行了,然后就可以保存到本地了,完事~印象笔记我平常用到的功能也不多,偏偏想用的功能是个bug,像个大冤种,某人的绩效怕是要挨刀了。当前印象笔记转换为PDF格式存在bug,转换后的PDF文件竟然只有半页,已反馈官方,待修复。使用印象笔记创建Markdown格式文件,并使用其提供的转换为PDF格式的功能。使用预览模式,然后在预览文件上右键选择打印,“目标打印机”选择另存为PDF;

2023-04-20 01:48:47 1490

原创 进程、线程退出方式

一、进程退出有8种方式使进程终止(termination),其中5种为正常终止:(1)从main返回。(2)调用exit。(3)调用_exit或_Exit。(4)最后一个线程从其启动例程返回。(5)最后一个线程调用pthread_exit。异常终止有3种方式:(6)调用abort。(7)接到一个信号并终止。(8)最后一个线程对取消请求作出响应。二、线程退出(1)线程可以简...

2023-04-06 13:21:00 271

原创 长连接和短连接区别和优缺点

TCP与UDPudp:面向无连接的通信协议,数据包括目的端口信息和源端口信息优点:面向无连接,操作简单,要求系统资源较少,速度快,由于不需要连接,可进行广播发送缺点:发送数据之前不需要与对方建立连接,接收到数据时也不需要发送确认信号,发送端不知道接收端是否正确接接收,不会重发,不可靠。tcp:面向连接的通讯协议,通过三次握手建立连接,通讯完成时四次挥手断开连接优点:在数据传输时,有确认...

2023-04-06 12:17:00 229

原创 SnowFlake雪花算法源码分析&灵活改造,常见分布式ID生成解决方案

带着几个关注点去研读源码算法设计的整体逻辑是什么,核心点是什么?算法是如何达到高并发的?算法的高并发能力极限?既然是生成ID,那么生成的可用量有多大,可用的时间为多少,ID的存储方式?算法是否有缺陷,如何避免或者改进?算法是否可自由拓展或改造,以契合当前项目需求?SnowFlake源码:/** * Twitter_Snowflake * SnowFlake的结构(每部分用...

2021-05-18 15:08:00 158

原创 LeetCode 93. 复原IP地址

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 93. 复原IP地址题目给定一个只包含数字的字符串,复原它并返回所有可能的 IP 地址格式。有效的 IP 地址正好由四个整数(每个整数位于 0 到 255...

2020-08-11 00:13:00 27

原创 LeetCode 696. 计数二进制子串

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 696. 计数二进制子串题目给定一个字符串s,计算具有相同数量0和1的非空(连续)子字符串的数量,并且这些子字符串中的所有0和所有1都是组合在一起的。重...

2020-08-10 23:36:00 27

原创 LeetCode 面试题 01.05. 一次编辑

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode题目字符串有三种编辑操作:插入一个字符、删除一个字符或者替换一个字符。 给定两个字符串,编写一个函数判定它们是否只需要一次(或者零次)编辑。示例1:输入...

2020-07-06 02:15:00 28

原创 LeetCode 287. 寻找重复数

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 287. 寻找重复数题目给定一个包含n + 1 个整数的数组nums,其数字都在 1 到 n之间(包括 1 和 n),可知至少存在一个重复的整数。假设...

2020-05-31 16:13:00 26

原创 LeetCode 5. 最长回文子串

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 5. 最长回文子串题目给定一个字符串 s,找到 s 中最长的回文子串。你可以假设s 的最大长度为 1000。示例 1:输入: "babad"输出: ...

2020-05-22 21:49:00 24

原创 LeetCode 21. 合并两个有序链表

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 21. 合并两个有序链表题目将两个升序链表合并为一个新的升序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。示例:输入:1->2-&g...

2020-05-22 21:32:00 20

原创 LeetCode 面试题55 - I. 二叉树的深度

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题55 - I. 二叉树的深度与以下题目相同前往:LeetCode 104. 二叉树的最大深度...

2020-05-22 21:15:00 45

原创 LeetCode 104. 二叉树的最大深度

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 104. 二叉树的最大深度题目给定一个二叉树,找出其最大深度。二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。说明:叶子节点是指没有子节点的节...

2020-05-22 21:14:00 24

原创 LeetCode 面试题53 - I. 在排序数组中查找数字 I

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题53 - I. 在排序数组中查找数字 I与以下题目相同前往:LeetCode 34. 在排序数组中查找元素的第一个和最后一个位置...

2020-05-22 21:03:00 45

原创 LeetCode 34. 在排序数组中查找元素的第一个和最后一个位置

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 34. 在排序数组中查找元素的第一个和最后一个位置题目给定一个按照升序排列的整数数组 nums,和一个目标值 target。找出给定目标值在数组中的开始位置...

2020-05-22 21:02:00 29

原创 LeetCode 面试题33. 二叉搜索树的后序遍历序列

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题33. 二叉搜索树的后序遍历序列题目输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历结果。如果是则返回true,否则返回false。假设输...

2020-05-22 20:16:00 28

原创 LeetCode 面试题26. 树的子结构

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题26. 树的子结构题目输入两棵二叉树A和B,判断B是不是A的子结构。(约定空树不是任意一个树的子结构)B是A的子结构, 即 A中有出现和B相同的结构...

2020-05-22 18:23:00 35

原创 LeetCode 210. 课程表 II

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 210. 课程表 II题目现在你总共有 n 门课需要选,记为0到n-1。在选修某些课程之前需要一些先修课程。例如,想要学习课程 0 ,你需要先完成...

2020-05-22 17:52:00 26

原创 LeetCode 面试题56 - II. 数组中数字出现的次数 II

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题56 - II. 数组中数字出现的次数 II题目在一个数组 nums 中除一个数字只出现一次之外,其他数字都出现了三次。请找出那个只出现一次的数字。...

2020-05-22 16:42:00 29

原创 LeetCode 面试题52. 两个链表的第一个公共节点

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题52. 两个链表的第一个公共节点与以下题目相同前往:LeetCode 160. 相交链表...

2020-05-22 15:55:00 30

原创 LeetCode 160. 相交链表

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 160. 相交链表题目编写一个程序,找到两个单链表相交的起始节点。如下面的两个链表:在节点 c1 开始相交。示例 1:输入:intersectVal...

2020-05-22 15:50:00 21

原创 LeetCode 面试题07. 重建二叉树

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题07. 重建二叉树与以下题目相同前往:LeetCode 105. 从前序与中序遍历序列构造二叉树...

2020-05-22 15:33:00 38

原创 LeetCode 105. 从前序与中序遍历序列构造二叉树

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 105. 从前序与中序遍历序列构造二叉树题目根据一棵树的前序遍历与中序遍历构造二叉树。注意:你可以假设树中没有重复的元素。例如,给出前序遍历 pre...

2020-05-22 15:30:00 26

原创 LeetCode 面试题58 - II. 左旋转字符串

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题58 - II. 左旋转字符串题目字符串的左旋转操作是把字符串前面的若干个字符转移到字符串的尾部。请定义一个函数实现字符串左旋转操作的功能。比如,输入...

2020-05-19 13:24:00 28

原创 LeetCode 面试题53 - II. 0~n-1中缺失的数字

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题53 - II. 0~n-1中缺失的数字题目一个长度为n-1的递增排序数组中的所有数字都是唯一的,并且每个数字都在范围0~n-1之内。在范围0~n-1...

2020-05-19 13:17:00 21

原创 LeetCode 面试题54. 二叉搜索树的第k大节点

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题54. 二叉搜索树的第k大节点题目给定一棵二叉搜索树,请找出其中第k大的节点。示例 1:输入: root = [3,1,4,null,2], k ...

2020-05-19 13:14:00 22

原创 LeetCode 680. 验证回文字符串 Ⅱ

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 680. 验证回文字符串 Ⅱ题目给定一个非空字符串s,最多删除一个字符。判断是否能成为回文字符串。示例 1:输入: "aba"输出: True示例...

2020-05-19 13:02:00 25

原创 LeetCode 面试题55 - II. 平衡二叉树

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题55 - II. 平衡二叉树与以下题目相同前往:LeetCode 110. 平衡二叉树...

2020-05-19 12:35:00 20

原创 LeetCode 110. 平衡二叉树

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 110. 平衡二叉树题目给定一个二叉树,判断它是否是高度平衡的二叉树。本题中,一棵高度平衡二叉树定义为:一个二叉树每个节点的左右两个子树的高度差的绝...

2020-05-19 12:34:00 21

原创 LeetCode 152. 乘积最大子数组

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 152. 乘积最大子数组题目给你一个整数数组 nums,请你找出数组中乘积最大的连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。示...

2020-05-18 18:33:00 21

原创 LeetCode 面试题58 - I. 翻转单词顺序

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题58 - I. 翻转单词顺序与以下题目相同前往:LeetCode 151. 翻转字符串里的单词...

2020-05-16 23:02:00 39

原创 LeetCode 151. 翻转字符串里的单词

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 151. 翻转字符串里的单词题目给定一个字符串,逐个翻转字符串中的每个单词。示例 1:输入: "the sky is blue"输出:"blue i...

2020-05-16 23:01:00 20

原创 LeetCode 25. K 个一组翻转链表

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 25. K 个一组翻转链表题目给你一个链表,每k个节点一组进行翻转,请你返回翻转后的链表。k是一个正整数,它的值小于或等于链表的长度。如果节点总数...

2020-05-16 22:32:00 18

原创 LeetCode 面试题61. 扑克牌中的顺子

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题61. 扑克牌中的顺子题目从扑克牌中随机抽5张牌,判断是不是一个顺子,即这5张牌是不是连续的。2~10为数字本身,A为1,J为11,Q为12,K为13...

2020-05-16 00:07:00 18

原创 LeetCode 面试题63. 股票的最大利润

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题63. 股票的最大利润与以下题目相同前往:LeetCode 121. 买卖股票的最佳时机...

2020-05-15 23:25:00 26

原创 LeetCode 121. 买卖股票的最佳时机

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 121. 买卖股票的最佳时机题目给定一个数组,它的第i 个元素是一支给定股票第 i 天的价格。如果你最多只允许完成一笔交易(即买入和卖出一支股票一次),...

2020-05-15 23:24:00 18

原创 LeetCode 面试题64. 求1+2+…+n

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题64. 求1+2+…+n题目求 1+2+...+n ,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断...

2020-05-15 23:11:00 21

原创 LeetCode 8. 字符串转换整数 (atoi)

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 8. 字符串转换整数 (atoi)题目请你来实现一个atoi函数,使其能将字符串转换成整数。首先,该函数会根据需要丢弃无用的开头空格字符,直到寻找到第...

2020-05-14 23:20:00 17

原创 LeetCode 面试题66. 构建乘积数组

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 面试题66. 构建乘积数组题目给定一个数组 A[0,1,…,n-1],请构建一个数组 B[0,1,…,n-1],其中 B 中的元素 B[i]=A[0]×A[...

2020-05-14 22:53:00 20

原创 LeetCode 136. 只出现一次的数字

我的LeetCode:https://leetcode-cn.com/u/ituring/我的LeetCode刷题源码[GitHub]:https://github.com/izhoujie/AlgorithmciiLeetCode 136. 只出现一次的数字题目给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。说明:你的算法应该具...

2020-05-14 22:03:00 21

空空如也

空空如也

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

TA关注的人

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