- 博客(10)
- 资源 (1)
- 收藏
- 关注
原创 7. 整数反转
题目地址(7. 整数反转) https://leetcode-cn.com/problems/reverse-integer/ 题目描述 给你一个 32 位的有符号整数 x ,返回将 x 中的数字部分反转后的结果。 如果反转后整数超过 32 位的有符号整数的范围 [−231, 231 − 1] ,就返回 0。 假设环境不允许存储 64 位整数(有符号或无符号)。 示例 1: 输入:x = 123 输出:321 示例 2: 输入:x = -123
2022-02-09 17:51:17 241
原创 C语言 -- 数据结构 --- 将二叉树的左右子树交换
C语言 – 数据结构 — 将二叉树的左右子树交换 #include<stdio.h> #include<stdlib.h> typedef struct Tree { int data; struct Tree *lchild; struct Tree *rchild; }Tree, *BitTree; BitTree CreateLink() { int data; BitTree T; scanf("%d", &data
2022-02-04 19:54:08 1275 1
原创 C语言 -- 数据结构 --- 求二叉树的深度和叶子节点数
C语言 – 数据结构 — 求二叉树的深度和叶子节点数 #include<stdio.h> #include<stdlib.h> typedef struct Tree { int data; struct Tree *lchild; struct Tree *rchild; }Tree, *BitTree; BitTree CreateLink() { int data; BitTree T; scanf("%d", &da
2022-02-04 18:16:32 1173
原创 C语言 -- 数据结构 --- 二叉树的遍历
二叉树的创建,前中后序遍历,层序遍历 #include<stdio.h> #include<stdlib.h> typedef struct Tree { int data; struct Tree *lchild; struct Tree *rchild; }Tree, *BitTree; BitTree CreateLink() { int data; BitTree T; scanf("%d", &data);
2022-02-03 21:21:14 850
原创 6. Z 字形变换
题目地址(6. Z 字形变换) https://leetcode-cn.com/problems/zigzag-conversion/ 题目描述 将一个给定字符串 s 根据给定的行数 numRows ,以从上往下、从左到右进行 Z 字形排列。 比如输入字符串为 "PAYPALISHIRING" 行数为 3 时,排列如下: P A H N A P L S I I G Y I R 之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:"PAHNAPLSIIGYIR"。 请你
2022-01-11 17:26:55 40
原创 5. 最长回文子串
题目地址(5. 最长回文子串) https://leetcode-cn.com/problems/longest-palindromic-substring/ 题目描述 给你一个字符串 s,找到 s 中最长的回文子串。 示例 1: 输入:s = "babad" 输出:"bab" 解释:"aba" 同样是符合题意的答案。 示例 2: 输入:s = "cbbd" 输出:"bb" 示例 3: 输入:s = "a" 输出:"a" 示例 4: 输入:s = "ac" 输出:"a"
2022-01-11 17:14:18 219
原创 3. 无重复字符的最长子串
题目地址(3. 无重复字符的最长子串) https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ 题目描述 给定一个字符串 s ,请你找出其中不含有重复字符的 最长子串 的长度。 示例 1: 输入: s = "abcabcbb" 输出: 3 解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。 示例 2: 输入: s = "bbbbb" 输出: 1 解释: 因为无重复字符的
2022-01-11 16:36:28 49
原创 2.两数相加
题目地址(2. 两数相加) https://leetcode-cn.com/problems/add-two-numbers/ 题目描述 给你两个 非空 的链表,表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的,并且每个节点只能存储 一位 数字。 请你将两个数相加,并以相同形式返回一个表示和的链表。 你可以假设除了数字 0 之外,这两个数都不会以 0 开头。 示例 1: 输入:l1 = [2,4,3], l2 = [5,6,4] 输出:[7,0,8] 解释:342 + 465 =
2022-01-11 16:27:02 51
原创 1.两数之和
题目地址(1. 两数之和) https://leetcode-cn.com/problems/two-sum/ 题目描述 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素在答案里不能重复出现。 你可以按任意顺序返回答案。 示例 1: 输入:nums = [2,7,11,15], target = 9 输出:[0,1] 解释:因为 num
2022-01-11 16:11:55 73
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人