随笔分类 - 力扣
摘要:1.题目 题目地址(805. 数组的均值分割 - 力扣(LeetCode)) https://leetcode.cn/problems/split-array-with-same-average/ 题目描述 给定你一个整数数组 nums 我们要将 nums 数组中的每个元素移动到 A 数组 或者 B
阅读全文
摘要:1.题目 题目地址(1049. 最后一块石头的重量 II - 力扣(LeetCode)) https://leetcode.cn/problems/last-stone-weight-ii/ 题目描述 有一堆石头,用整数数组 stones 表示。其中 stones[i] 表示第 i 块石头的重量。
阅读全文
摘要:1.题目 题目地址(494. 目标和 - 力扣(LeetCode)) https://leetcode.cn/problems/target-sum/ 题目描述 给你一个非负整数数组 nums 和一个整数 target 。 向数组中的每个整数前添加 '+' 或 '-' ,然后串联起所有整数,可以构造
阅读全文
摘要:1.题目 题目地址(474. 一和零 - 力扣(LeetCode)) https://leetcode.cn/problems/ones-and-zeroes/ 题目描述 给你一个二进制字符串数组 strs 和两个整数 m 和 n 。 请你找出并返回 strs 的最大子集的长度,该子集中 最多 有
阅读全文
摘要:1.题目 题目地址(416. 分割等和子集 - 力扣(LeetCode)) https://leetcode.cn/problems/partition-equal-subset-sum/ 题目描述 给你一个 只包含正整数 的 非空 数组 nums 。请你判断是否可以将这个数组分割成两个子集,使得两
阅读全文
摘要:1.题目 “答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。 得到“答案正确”的条件是: 字符串中必须仅有 P、 A、 T这三种字符,不可以包含其它字符; 任意形如 xPATx
阅读全文
摘要:1.题目 题目地址(636. 函数的独占时间 - 力扣(LeetCode)) https://leetcode.cn/problems/exclusive-time-of-functions/ 题目描述 有一个 单线程 CPU 正在运行一个含有 n 道函数的程序。每道函数都有一个位于 0 和 n-1
阅读全文
摘要:1.题目 题目地址(1209. 删除字符串中的所有相邻重复项 II - 力扣(LeetCode)) https://leetcode.cn/problems/remove-all-adjacent-duplicates-in-string-ii/ 题目描述 给你一个字符串 s,「k 倍重复项删除操作
阅读全文
摘要:1.题目 题目地址(316. 去除重复字母 - 力扣(LeetCode)) https://leetcode.cn/problems/remove-duplicate-letters/ 题目描述 给你一个字符串 s ,请你去除字符串中重复的字母,使得每个字母只出现一次。需保证 返回结果的字典序最小(
阅读全文
摘要:1.题目 题目地址(901. 股票价格跨度 - 力扣(LeetCode)) https://leetcode.cn/problems/online-stock-span/ 题目描述 设计一个算法收集某些股票的每日报价,并返回该股票当日价格的 跨度 。 当日股票价格的 跨度 被定义为股票价格小于或等于
阅读全文
摘要:1.题目 题目地址(739. 每日温度 - 力扣(LeetCode)) https://leetcode.cn/problems/daily-temperatures/ 题目描述 给定一个整数数组 temperatures ,表示每天的温度,返回一个数组 answer ,其中 answer[i] 是
阅读全文
摘要:1.题目介绍 题目地址(84. 柱状图中最大的矩形 - 力扣(LeetCode)) https://leetcode.cn/problems/largest-rectangle-in-histogram/ 题目描述 给定 n 个非负整数,用来表示柱状图中各个柱子的高度。每个柱子彼此相邻,且宽度为 1
阅读全文
摘要:1.题目 题目地址(496. 下一个更大元素 I - 力扣(LeetCode)) https://leetcode.cn/problems/next-greater-element-i/ 题目描述 nums1 中数字 x 的 下一个更大元素 是指 x 在 nums2 中对应位置 右侧 的 第一个 比
阅读全文
摘要:1.题目 题目地址(225. 用队列实现栈 - 力扣(LeetCode)) https://leetcode.cn/problems/implement-stack-using-queues/ 题目描述 请你仅使用两个队列实现一个后入先出(LIFO)的栈,并支持普通栈的全部四种操作(push、top
阅读全文
摘要:1.题目信息 题目地址(232. 用栈实现队列 - 力扣(LeetCode)) https://leetcode.cn/problems/implement-queue-using-stacks/ 题目描述 请你仅使用两个栈实现先入先出队列。队列应当支持一般队列支持的所有操作(push、pop、pe
阅读全文
摘要:1.题目 题目地址(349. 两个数组的交集 - 力扣(LeetCode)) https://leetcode.cn/problems/intersection-of-two-arrays/ 题目描述 给定两个数组 nums1 和 nums2 ,返回 它们的 交集 。输出结果中的每个元素一定是 唯一
阅读全文
摘要:1.题目 题目地址(706. 设计哈希映射 - 力扣(LeetCode)) https://leetcode.cn/problems/design-hashmap/ 题目描述 不使用任何内建的哈希表库设计一个哈希映射(HashMap)。 实现 MyHashMap 类: MyHashMap() 用空映
阅读全文
摘要:1.题目 题目地址(705. 设计哈希集合 - 力扣(LeetCode)) https://leetcode.cn/problems/design-hashset/ 题目描述 不使用任何内建的哈希表库设计一个哈希集合(HashSet)。 实现 MyHashSet 类: void add(key) 向
阅读全文
摘要:1.题目 题目地址(303. 区域和检索 - 数组不可变 - 力扣(LeetCode)) https://leetcode.cn/problems/range-sum-query-immutable/ 题目描述 给定一个整数数组 nums,处理以下类型的多个查询: 计算索引 left 和 right
阅读全文
摘要:1.题目 题目地址(430. 扁平化多级双向链表 - 力扣(LeetCode)) https://leetcode.cn/problems/flatten-a-multilevel-doubly-linked-list/ 题目描述 你会得到一个双链表,其中包含的节点有一个下一个指针、一个前一个指针和
阅读全文