GoCalf Calf 的自留地 · 昙花一现

全站内容

Calf

这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。

  • 3065. Minimum Operations to Exceed Threshold Value I

    Coding

    #Problem You are given a 0-indexed integer array nums, and an integer k. In one operation, you can remove one occurrence of the smallest element of nums. Return the minimum number of operations needed so that all elements of the array are …

    easy
  • 3066. Minimum Operations to Exceed Threshold Value II

    Coding

    #Problem You are given a 0-indexed integer array nums, and an integer k. In one operation, you will: Take the two smallest integers x and y in nums. Remove x and y from nums. Add min(x, y) * 2 + max(x, y) anywhere in the array. Note that …

    medium
  • 3083. Existence of a Substring in a String and Its Reverse

    Coding

    #Problem Given a string s, find any substring of length 2 which is also present in the reverse of s. A substring is a contiguous sequence of characters within a string. Return true if such a substring exists, and false otherwise. …

    easy
  • 309. Best Time to Buy and Sell Stock with Cooldown

    Coding

    #Problem You are given an array prices where prices[i] is the price of a given stock on the iᵗʰ day. Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock …

    medium
  • 3095. Shortest Subarray With OR at Least K I

    Coding

    #Problem You are given an array nums of non-negative integers and an integer k. An array is called special if the bitwise OR of all of its elements is at least k. Return the length of the shortest special non-empty subarray of nums, or …

    easy
  • 3097. Shortest Subarray With OR at Least K II

    Coding

    #Problem 跟 3095. Shortest Subarray With OR at Least K I 一模一样,只是问题规模更大。 https://leetcode.cn/problems/shortest-subarray-with-or-at-least-k-ii/ Constraints: 1 <= nums.length <= 2 * 10⁵ 0 <= nums[i] <= 10⁹ 0 <= k <= 10⁹ #Test Cases python 复制 …

    medium
  • 3105. Longest Strictly Increasing or Strictly Decreasing Subarray

    Coding

    #Problem You are given an array of integers nums. Return the length of the longest subarray of nums which is either strictly increasing or strictly decreasing. A subarray is a contiguous non-empty sequence of elements within an array. An …

    easy
  • 3138. Minimum Length of Anagram Concatenation

    Coding

    #Problem You are given a string s, which is known to be a concatenation of anagrams of some string t. Return the minimum possible length of the string t. An anagram is formed by rearranging the letters of a string. For example, “aab”, …

    medium
  • 3151. Special Array I

    Coding

    #Problem An array is considered special if every pair of its adjacent elements contains two numbers with different parity. You are given an array of integers nums. Return true if nums is a special array, otherwise, return false. …

    easy
  • 3152. Special Array II

    Coding

    #Problem An array is considered special if every pair of its adjacent elements contains two numbers with different parity. You are given an array of integer nums and a 2D integer matrix queries, where for queries[i] = [fromᵢ, toᵢ] your task …

    medium