自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 资源 (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 696

原创 Ubuntu开机默认进入命令行模式/用户图形界面

我有一台2012年买的ThinkPad S430,这台电脑距今已经11年了,最近给它装了Ubuntu,因为听说Linux系统对硬件资源的消耗比较低,但是装上Ubuntu系统之后,电脑的风扇呼呼在响,也比较卡。在网上查了一下,由于Ubuntu的X-Window没有关闭,消耗资源依旧会很大,于是便想要在Ubuntu启动的时候,直接进入命令行模式。

2022-10-07 19:25:00 7455

原创 【LeetCode】141、环形链表

【声明】如果有侵权,请联系作者删除侵权部分。如果有错误,请联系作者修改错误部分。如果有转载,请标明出处。【难度】简单【题目】给定一个链表,判断链表中是否有环。如果链表中有某个节点,可以通过连续跟踪next指针再次到达,则链表中存在环,为了表示给定链表中的环,我们使用整数pos来表示链表尾连接到链表中的位置(索引从0开始)。如果pos是-1,则在该链表中没有环。注意:pos不作为参数进行传递,仅仅是为了标识链表的实际情况。如果链表中存在环,则返回true。否则,返回fals

2020-10-10 00:15:31 84

原创 【LeetCode】1427、字符串的左右移

【声明】如果有侵权,请联系作者删除侵权部分。如果有错误,请联系作者修改错误部分。如果有转载,请标明出处。【难度】简单【题目】给定一个包含小写英文字母的字符串s以及一个矩阵shift,其中shift[i] = [direction, amount]:direction可以为0(表示左移)或1(表示右移)。 amount表示s左右移的位数。 左移 1 位表示移除s的第一个字符,并将该字符插入到 s 的结尾。 类似地,右移 1 位表示移除s的最...

2020-10-08 21:23:51 588

原创 【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 206

原创 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 91

原创 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 118

原创 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 160

原创 872.Leaf-Similar Trees

872.Leaf-Similar Trees题目链接:原题题目大意:比较两个二叉树的所有叶子结点是否相同(顺序和数值均相同),如果相同,则返回True,否则返回False。思路:采用DFS(Depth-First-Search)遍历得到二叉树的所有叶子节点,并按照顺序存入数组中,最后比较两个数组是否相同,如果相同,则返回True,否则返回False。代码:/** ...

2018-07-23 17:23:25 162

原创 617.Merge Two Binary Trees

617.Merge Two Binary Trees题目链接:点此查看原题题目意思:合并两个二叉树,两棵树中的一些节点会被重叠,另一些不会。两棵树中对应节点的合并规则如下:如果两个节点都不为空,则合并两个节点的值作为新节点的值如果有一个节点为空,则用不空的节点作为新节点解题思路:给定两颗二叉树的根节点t1和t2,做如下操作:如果t1和t2都为空指针,则返回空...

2018-07-23 16:43:03 102

原创 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 208

原创 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 122

原创 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 118

原创 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 257

原创 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 1715

原创 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 149

原创 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 210

原创 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 292

原创 scanf函数的返回值

scanf函数的返回值就是成功输入的变量个数

2017-09-06 17:40:23 245

原创 交换变量

三变量交换法:#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 160

SQL学习笔记

SQL学习文档 主要是MySQL Creat insert select

2013-07-28

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

TA关注的人

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