随笔分类 - LeetCode(Java)
摘要:LeetCode 02.07. Intersection of Two Linked Lists LCCI (链表相交) 题目 链接 https://leetcode.cn/problems/intersection-of-two-linked-lists-lcci/ 问题描述 给你两个单链表的头节
阅读全文
摘要:LeetCode 24. Swap Nodes in Pairs (两两交换链表中的节点) 题目 链接 https://leetcode.cn/problems/swap-nodes-in-pairs/ 问题描述 给你一个链表,两两交换其中相邻的节点,并返回交换后链表的头节点。你必须在不修改节点内部
阅读全文
摘要:LeetCode 707. Design Linked List (设计链表) 题目 链接 https://leetcode.cn/problems/design-linked-list/ 问题描述 设计链表的实现。您可以选择使用单链表或双链表。单链表中的节点应该具有两个属性:val 和 next。
阅读全文
摘要:LeetCode 203. Remove Linked List Elements (移除链表元素) 题目 链接 https://leetcode-cn.com/problems/remove-linked-list-elements/ 问题描述 给你一个链表的头节点 head 和一个整数 val
阅读全文
摘要:LeetCode 59. Spiral Matrix II (螺旋矩阵 II) 题目 链接 https://leetcode-cn.com/problems/spiral-matrix-ii/ 问题描述 给你一个正整数 n ,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的 n x
阅读全文
摘要:LeetCode 54. Spiral Matrix (螺旋矩阵) 题目 链接 https://leetcode-cn.com/problems/spiral-matrix/ 问题描述 给你一个 m 行 n 列的矩阵 matrix ,请按照 顺时针螺旋顺序 ,返回矩阵中的所有元素。 示例 输入:ma
阅读全文
摘要:LeetCode 904. Fruit Into Baskets (水果成篮) 题目 链接 问题描述 你正在探访一家农场,农场从左到右种植了一排果树。这些树用一个整数数组 fruits 表示,其中 fruits[i] 是第 i 棵树上的水果 种类 。 你想要尽可能多地收集水果。然而,农场的主人设定了
阅读全文
摘要:LeetCode 844. Backspace String Compare (比较含退格的字符串) 题目 链接 https://leetcode-cn.com/problems/backspace-string-compare/ 问题描述 给定 s 和 t 两个字符串,当它们分别被输入到空白的文本
阅读全文
摘要:LeetCode 852. Peak Index in a Mountain Array (山脉数组的峰顶索引) 题目 链接 https://leetcode-cn.com/problems/peak-index-in-a-mountain-array/ 问题描述 符合下列属性的数组 arr 称为
阅读全文
摘要:LeetCode 367. Valid Perfect Square (有效的完全平方数) 题目 链接 https://leetcode-cn.com/problems/valid-perfect-square/ 问题描述 给定一个 正整数 num ,编写一个函数,如果 num 是一个完全平方数,则
阅读全文
摘要:LeetCode 1491. Average Salary Excluding the Minimum and Maximum Salary () 题目 链接 https://leetcode-cn.com/problems/average-salary-excluding-the-minimum-
阅读全文
摘要:LeetCode 1523. Count Odd Numbers in an Interval Range (在区间范围内统计奇数数目) 题目 链接 https://leetcode-cn.com/problems/count-odd-numbers-in-an-interval-range/ 问题
阅读全文
摘要:LeetCode 18. 4Sum (四数之和) 题目 链接 https://leetcode-cn.com/problems/4sum/ 问题描述 给你一个由 n 个整数组成的数组 nums ,和一个目标值 target 。请你找出并返回满足下述全部条件且不重复的四元组 [nums[a], num
阅读全文
摘要:LeetCode 15. 3Sum (三数之和) 题目 链接 https://leetcode-cn.com/problems/3sum/ 问题描述 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?请你找出所有和为 0
阅读全文
摘要:LeetCode 1137. N-th Tribonacci Number (第 N 个泰波那契数) 题目 链接 https://leetcode-cn.com/problems/n-th-tribonacci-number/ 问题描述 泰波那契序列 Tn 定义如下: T0 = 0, T1 = 1,
阅读全文
摘要:LeetCode 509. Fibonacci Number (斐波那契数) 题目 链接 https://leetcode-cn.com/problems/fibonacci-number/ 问题描述 斐波那契数 (通常用 F(n) 表示)形成的序列称为 斐波那契数列 。该数列由 0 和 1 开始,
阅读全文
摘要:LeetCode 46. Permutations (全排列) 题目 链接 https://leetcode-cn.com/problems/permutations/ 问题描述 给定一个不含重复数字的数组 nums ,返回其 所有可能的全排列 。你可以 按任意顺序 返回答案。 示例 输入:nums
阅读全文
摘要:LeetCode 210. Course Schedule II (课程表 II) 题目 链接 https://leetcode-cn.com/problems/course-schedule-ii/ 问题描述 现在你总共有 numCourses 门课需要选,记为 0 到 numCourses -
阅读全文
摘要:LeetCode 207. Course Schedule (课程表) 题目 链接 https://leetcode-cn.com/problems/course-schedule/ 问题描述 你这个学期必须选修 numCourses 门课程,记为 0 到 numCourses - 1 。 在选修某
阅读全文
摘要:LeetCode 797. All Paths From Source to Target (所有可能的路径) 题目 链接 https://leetcode-cn.com/problems/all-paths-from-source-to-target/ 问题描述 给你一个有 n 个节点的 有向无环
阅读全文