- 博客(22)
- 资源 (1)
- 问答 (1)
- 收藏
- 关注

原创 LeetCode题解(除加锁,正在完善)
以下是每个题对应的题解:LeetCode 1 : Two Sum 点此查看LeetCode 2 : Add Two Numbers点此查看LeetCode 3 : Longest Substring Without Repeating Characters点此查看正在更新中……...
2018-10-15 13:33:20
941
原创 架构到底是什么?
它是指软件系统的角色之间的关系,对应到架构图中其实就是连接线,角色之间的关系不能乱连,任何关系最后都需要代码来实现,包括连接方式(HTTP、TCP、UDP 和串口等)、数据协议(JSON、XML 和二进制等)以及具体的接口等。最常见的微服务拆分其实就是将整体复杂的业务系统按照业务领域的方式,拆分为多个微服务,每个微服务就是系统的一个角色。根据系统的定义可知:系统是由有关联关系的个体组成的,并且个体之间存在某种运作规则,并且这些个体组成系统之后,系统产生了一种新的能力,能完成单个个体无法独自完成的能力。
2024-12-24 23:24:52
377
原创 《编程珠玑》——开篇
因为该问题的约束条件中描述了输入文件中最多有1千万个不重复的7位数,内存的大小限制位1MB。针对上面的问题,可以构造一个长度为1000万个位的字符串,从输入文件中挨个读取输入,文件中的每个7位数都不会重复,每读入到一个7位数i,便将字符串中的第i位置为1,表示该数字出现了,进行排序的时候,从0开始遍历该字符串,出现1的数代表刚才输入文件中有对应的数值,遍历完该字符串也就是从小到大完成了排序,最后将排序结果输出到输出文件中,便完成了该问题所要求的排序结果。以上就是问题的描述规范,应包含输入、输出和约束。
2024-09-17 14:19:21
538
1
原创 Ubuntu开机默认进入命令行模式/用户图形界面
我有一台2012年买的ThinkPad S430,这台电脑距今已经11年了,最近给它装了Ubuntu,因为听说Linux系统对硬件资源的消耗比较低,但是装上Ubuntu系统之后,电脑的风扇呼呼在响,也比较卡。在网上查了一下,由于Ubuntu的X-Window没有关闭,消耗资源依旧会很大,于是便想要在Ubuntu启动的时候,直接进入命令行模式。
2022-10-07 19:25:00
8384
原创 【LeetCode】141、环形链表
【声明】如果有侵权,请联系作者删除侵权部分。如果有错误,请联系作者修改错误部分。如果有转载,请标明出处。【难度】简单【题目】给定一个链表,判断链表中是否有环。如果链表中有某个节点,可以通过连续跟踪next指针再次到达,则链表中存在环,为了表示给定链表中的环,我们使用整数pos来表示链表尾连接到链表中的位置(索引从0开始)。如果pos是-1,则在该链表中没有环。注意:pos不作为参数进行传递,仅仅是为了标识链表的实际情况。如果链表中存在环,则返回true。否则,返回fals
2020-10-10 00:15:31
127
原创 【LeetCode】1427、字符串的左右移
【声明】如果有侵权,请联系作者删除侵权部分。如果有错误,请联系作者修改错误部分。如果有转载,请标明出处。【难度】简单【题目】给定一个包含小写英文字母的字符串s以及一个矩阵shift,其中shift[i] = [direction, amount]:direction可以为0(表示左移)或1(表示右移)。 amount表示s左右移的位数。 左移 1 位表示移除s的第一个字符,并将该字符插入到 s 的结尾。 类似地,右移 1 位表示移除s的最...
2020-10-08 21:23:51
702
原创 【LeetCode】1582. 二进制矩阵中的特殊位置
【难度】简单【题目】给你一个大小为rows x cols的矩阵mat,其中mat[i][j]是0或1,请返回矩阵mat中特殊位置的数目。特殊位置 定义:如果 mat[i][j] == 1 并且第 i 行和第 j 列中的所有其他元素均为 0(行和列的下标均 从 0 开始 ),则位置 (i, j) 被称为特殊位置。【示例】示例 1:输入:mat = [[1,0,0], [0,0,1], ...
2020-10-06 01:30:25
249
原创 LeetCode 3:Longest Substring Without Repeating Characters(无重复字符的最长子串)
题目:Given a string,find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3Explanation: The answer is "abc", with the length of 3.Example 2...
2018-10-23 16:42:21
123
原创 LeetCode 2 : Add Two Numbers(两数相加)
题目:You are given twonon-emptylinked lists representing two non-negative integers. The digits are stored inreverse orderand each of their nodes contain a single digit. Add the two numbers and ret...
2018-10-16 15:04:15
158
原创 LeetCode 1 : Two Sum(两数之和)
题目:Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would haveexactlyone solution, and you may not use the...
2018-10-15 13:40:07
187
原创 872.Leaf-Similar Trees
872.Leaf-Similar Trees题目链接:原题题目大意:比较两个二叉树的所有叶子结点是否相同(顺序和数值均相同),如果相同,则返回True,否则返回False。思路:采用DFS(Depth-First-Search)遍历得到二叉树的所有叶子节点,并按照顺序存入数组中,最后比较两个数组是否相同,如果相同,则返回True,否则返回False。代码:/** ...
2018-07-23 17:23:25
203
原创 617.Merge Two Binary Trees
617.Merge Two Binary Trees题目链接:点此查看原题题目意思:合并两个二叉树,两棵树中的一些节点会被重叠,另一些不会。两棵树中对应节点的合并规则如下:如果两个节点都不为空,则合并两个节点的值作为新节点的值如果有一个节点为空,则用不空的节点作为新节点解题思路:给定两颗二叉树的根节点t1和t2,做如下操作:如果t1和t2都为空指针,则返回空...
2018-07-23 16:43:03
141
原创 657.Judge Route Circle(判断环形路径)
657.Judge Route Circle(判断环形路径)Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.The...
2018-06-21 21:48:23
245
原创 461.Hamming Distance
461.Hamming DistanceThe Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y , calculate the Hamming distance....
2018-06-20 13:57:53
157
原创 852. Peak Index in a Mountain Array
原创内容,禁止转载Peak Index in a Mountain ArrayLet’s call an array A a mountain if the following properties hold:A.length >= 3 There exists some 0 < i < A.length - 1 such that A[0] < A[1] &...
2018-06-20 13:47:22
157
原创 804. Unique Morse Code Words(独一无二的莫尔斯码单词)
题目International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: “a” maps to “.-“, “b” maps to “-…”, “c” maps to “-.-.”, and so on.For...
2018-05-15 13:59:58
301
原创 832.Flipping an Image(翻转图像)
题目Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally means that each row of the image is reversed. For e...
2018-05-14 20:42:44
2209
原创 771. Jewels and Stones(珠宝和石头)
题目: You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of th...
2018-05-09 21:09:44
187
原创 malloc,calloc和realloc
C语言在进行动态内存时常会用到的三个函数分别是malloc,calloc和realloc。malloc函数原型为:void *malloc(size_t size);malloc的作用用于在内存中开辟连续的size个字节,并返回该内存块的起始地址,如果开辟内存失败,则返回NULL指针。通常情况下,直接写出size为多少有些不太方便,这样的程序也不方便移植。如:int *p=mal
2017-10-13 13:29:56
252
原创 C语言文件读写
重定向方式:读:freopen("filenamein","r",stdin);写:freopen("filenameout","w",stdout);fopen方式:读:File *fin;fin = stdin;fin = fopen("filenamein","rb");fscanf(fin,"%d",&x);fclose(fin);写:File
2017-09-06 21:51:58
329
原创 交换变量
三变量交换法:#include int main(){ int a,b,t; scanf("%d%d",&a,&b); t = a; a = b; b = t; printf("%d %d\n" , a ,b ); return 0;}不借助其他变量:#include int main(){
2017-09-06 11:16:55
195
如何在Java Web中画出项目关键路径图?
2017-05-03
TA创建的收藏夹 TA关注的收藏夹
TA关注的人