Avatar

Organizations

43 results for 中等
  • 给你一个整数数组  nums,将它重新排列成  nums[0] < nums[1] > nums[2] < nums[3]...  的顺序。

    你可以假设所有输入数组都可以得到满足题目要求的结果。

    leetcode 中等 数组 分治 快速选择 Created Sun, 01 Jan 2023 17:10:05 +0800
  • 给你一个整数数组 nums ,数组中共有 n 个整数。132 模式的子序列由三个整数 nums[i]nums[j]nums[k]组成,并同时满足:i < j < knums[i] < nums[k] < nums[j]

    如果 nums 中存在 132 模式的子序列 ,返回 true ;否则,返回false

    leetcode 中等 数组 二分查找 Created Wed, 21 Dec 2022 18:14:26 +0800
  • 有一些球形气球贴在一堵用 XY 平面表示的墙面上。墙面上的气球记录在整数数组  points ,其中 \(points[i] = [x_{start}, x_{end}]\)  表示水平直径在  \(x*{start}\)  和 \(x*{end}\)之间的气球。你不知道气球的确切 y 坐标。

    一支弓箭可以沿着 x 轴从不同点 完全垂直 地射出。在坐标 x处射出一支箭,若有一个气球的直径的开始和结束坐标为 \(x*{start}\),\(x*{end}\), 且满足  \(x*{start} ≤ x ≤ x*{end}\),则该气球会被引爆。可以射出的弓箭的数量 没有限制 。弓箭一旦被射出之后,可以无限地前进。

    给你一个数组 points ,返回引爆所有气球所必须射出的 最小弓箭数。

    leetcode 中等 贪心 数组 排序 Created Fri, 02 Dec 2022 15:26:34 +0800
  • 给你一个整数数组  nums,其中恰好有两个元素只出现一次,其余所有元素均出现两次。找出只出现一次的那两个元素。你可以按 任意顺序 返回答案。

    leetcode 中等 位运算 数组 Created Mon, 19 Sep 2022 16:22:28 +0800
  • 给你一个 只包含正整数非空 数组  nums。请你判断是否可以将这个数组分割成两个子集,使得两个子集的元素和相等。

    leetcode 中等 数组 动态规划 Created Tue, 13 Sep 2022 15:17:46 +0800
  • 给你一个整数数组 nums 。玩家 1 和玩家 2 基于这个数组设计了一个游戏。

    玩家 1 和玩家 2 轮流进行自己的回合,玩家 1 先手。开始时,两个玩家的初始分值都是 0。每一回合,玩家从数组的任意一端取一个数字(即,nums[0]nums[nums.length - 1]),取到的数字将会从数组中移除(数组长度减 1)。玩家选中的数字将会加到他的得分上。当数组中没有剩余数字可取时,游戏结束。

    如果玩家 1 能成为赢家,返回 true 。如果两个玩家得分相等,同样认为玩家 1 是游戏的赢家,也返回 true。你可以假设每个玩家的玩法都会使他的分数最大化。

    leetcode 中等 递归 数组 数学 Created Tue, 13 Sep 2022 13:43:09 +0800
  • 给定一个整数数组prices,其中第  prices[i]  表示第  i  天的股票价格。​

    设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票):

    • 卖出股票后,你无法在第二天买入股票 (即冷冻期为 1 天)。
    leetcode 中等 数组 动态规划 Created Thu, 08 Sep 2022 14:15:02 +0800
  • Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k.

    A subarray is a contiguous non-empty sequence of elements within an array.

    leetcode 中等 数组 哈希表 前缀和 Created Mon, 27 Jun 2022 14:37:09 +0800
  • Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.

    If the fractional part is repeating, enclose the repeating part in parentheses.

    If multiple answers are possible, return any of them.

    It is guaranteed that the length of the answer string is less than 104 for all the given inputs.

    leetcode 中等 哈希表 数学 字符串 Created Tue, 21 Jun 2022 15:53:27 +0800
  • Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator.

    The integer division should truncate toward zero, which means losing its fractional part. For example, 8.345 would be truncated to 8, and -2.7335 would be truncated to -2.

    Return the quotient after dividing dividend by divisor.

    leetcode 中等 位运算 数学 Created Tue, 21 Jun 2022 15:53:24 +0800
Next