随笔分类 - LeetCode(Java)
摘要:LeetCode 20. Valid Parentheses (有效的括号) 题目 链接 https://leetcode-cn.com/problems/valid-parentheses 问题描述 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。 有
阅读全文
摘要:LeetCode 53. Maximum Subarray (最大子序和) 题目 链接 https://leetcode-cn.com/problems/maximum-subarray 问题描述 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。
阅读全文
摘要:448. Find All Numbers Disappeared in an Array(找到所有数组中消失的数字) 链接 https://leetcode cn.com/problems/find all numbers disappeared in an array 题目 给定一个范围在 1
阅读全文
摘要:976. Largest Perimeter Triangle(三角形的最大周长) 链接 https://leetcode cn.com/problems/largest perimeter triangle 题目 给定由一些正数(代表长度)组成的数组 A,返回由其中三个长度组成的、面积不为零的三角
阅读全文
摘要:1295. Find Numbers with Even Number of Digits(统计位数为偶数的数字) 链接 https://leetcode cn.com/problems/find numbers with even number of digits 题目 给你一个整数数组 nums
阅读全文
摘要:LeetCode 374. Guess Number Higher or Lower(猜数字大小) 题目 链接 https://leetcode-cn.com/problems/guess-number-higher-or-lower 问题描述 猜数字游戏的规则如下: 每轮游戏,我都会从 1 到 n
阅读全文
摘要:LeetCode 278. First Bad Version(第一个错误的版本) 题目 链接 https://leetcode-cn.com/problems/first-bad-version 问题描述 你是产品经理,目前正在带领一个团队开发新的产品。不幸的是,你的产品的最新版本没有通过质量检测
阅读全文
摘要:LeetCode 35. Search Insert Position (搜索插入位置) 题目 链接 https://leetcode-cn.com/problems/search-insert-position/ 问题描述 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值
阅读全文
摘要:LeetCode 796. Rotate String (旋转字符串) 题目 链接 问题描述 给定两个字符串, s 和 goal。如果在若干次旋转操作之后,s 能变成 goal ,那么返回 true 。 s 的 旋转操作 就是将 s 最左边的字符移动到最右边。 例如, 若 s = 'abcde',在
阅读全文
摘要:LeetCode 704. Binary Search (二分查找) 题目 链接 https://leetcode-cn.com/problems/binary-search 问题描述 给定一个 n 个元素有序的(升序)整型数组 nums 和一个目标值 target ,写一个函数搜索 nums 中的
阅读全文
摘要:961. N Repeated Element in Size 2N Array(重复 N 次的元素) 链接 https://leetcode cn.com/problems/n repeated element in size 2n array 题目 在大小为 2N 的数组 A 中有 N+1 个不
阅读全文
摘要:1051. Height Checker(高度检查器) 链接 https://leetcode cn.com/problems/height checker 题目 学校在拍年度纪念照时,一般要求学生按照 非递减 的高度顺序排列。 请你返回能让所有学生以 非递减 高度排列的最小必要移动人数。 示例:
阅读全文
摘要:67. Add Binary(二进制求和) 链接 https://leetcode cn.com/problems/add binary 题目 给定两个二进制字符串,返回他们的和(用二进制表示)。 输入为非空字符串且只包含数字 1 和 0。 示例 1: 输入: a = "11", b = "1" 输
阅读全文
摘要:167. Two Sum II - Input array is sorted(两数之和 II - 输入有序数组) 链接 https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted 题目 给定一个已按照升序排列 的有序数组,找到
阅读全文
摘要:189. Rotate Array(旋转数组) 链接 https://leetcode cn.com/problems/rotate array 题目 给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: [1,2,3,4,5,6,7] 和 k = 3 输出:
阅读全文
摘要:965. Univalued Binary Tree(单值二叉树) 链接 https://leetcode cn.com/problems/univalued binary tree 题目 如果二叉树每个节点都具有相同的值,那么该二叉树就是单值二叉树。 只有给定的树是单值二叉树时,才返回 true;
阅读全文
摘要:111. Minimum Depth of Binary Tree(二叉树的最小深度) 链接 https://leetcode cn.com/problems/minimum depth of binary tree/ 题目 给定一个二叉树,找出其最小深度。 最小深度是从根节点到最近叶子节点的最短路
阅读全文
摘要:104. Maximum Depth of Binary Tree(二叉树的最大深度) 链接 https://leetcode cn.com/problems/maximum depth of binary tree 题目 给定一个二叉树,找出其最大深度。 二叉树的深度为根节点到最远叶子节点的最长路
阅读全文
摘要:58. Length of Last Word(最后一个单词的长度) 链接 https://leetcode cn.com/problems/length of last word 题目 给定一个仅包含大小写字母和空格 ' ' 的字符串 s,返回其最后一个单词的长度。 如果字符串从左向右滚动显示,那
阅读全文
摘要:41. First Missing Positive(缺失的第一个正数) 链接 https://leetcode cn.com/problems/first missing positive 题目 给定一个未排序的整数数组,找出其中没有出现的最小的正整数。 示例 1: 输入: [1,2,0] 输出:
阅读全文

浙公网安备 33010602011771号