GoCalf Calf 的自留地 · 昙花一现

全站内容

medium

  • 2944. Minimum Number of Coins for Fruits

    Coding

    #Problem You are given an 0-indexed integer array prices where prices[i] denotes the number of coins needed to purchase the (i + 1)ᵗʰ fruit. The fruit market has the following reward for each fruit: If you purchase the (i + 1)ᵗʰ fruit at …

    medium
  • 1415. The k-th Lexicographical String of All Happy Strings of Length n

    Coding

    #Problem A happy string is a string that: consists only of letters of the set ['a', 'b', 'c']. s[i] != s[i + 1] for all values of i from 1 to s.length - 1 (string is 1-indexed). For example, strings “abc”, “ac”, “b” and “abcbabcbcb” are all …

    medium
  • 624. Maximum Distance in Arrays

    Coding

    #Problem You are given m arrays, where each array is sorted in ascending order. You can pick up two integers from two different arrays (each array picks one) and calculate the distance. We define the distance between two integers a and b to …

    medium
  • 2375. Construct Smallest Number From DI String

    Coding

    #Problem You are given a 0-indexed string pattern of length n consisting of the characters 'I' meaning increasing and 'D' meaning decreasing. A 0-indexed string num of length n + 1 is created using the following conditions: num consists of …

    medium
  • 2080. Range Frequency Queries

    Coding

    #Problem Design a data structure to find the frequency of a given value in a given subarray. The frequency of a value in a subarray is the number of occurrences of that value in the subarray. Implement the RangeFreqQuery class: …

    medium
  • 1079. Letter Tile Possibilities

    Coding

    #Problem You have n tiles, where each tile has one letter tiles[i] printed on it. Return the number of possible non-empty sequences of letters you can make using the letters printed on those tiles. …

    medium
  • 1718. Construct the Lexicographically Largest Valid Sequence

    Coding

    #Problem Given an integer n, find a sequence that satisfies all of the following: The integer 1 occurs once in the sequence. Each integer between 2 and n occurs twice in the sequence. For every integer i between 2 and n, the distance …

    medium
  • 2698. Find the Punishment Number of an Integer

    Coding

    #Problem Given a positive integer n, return the punishment number of n. The punishment number of n is defined as the sum of the squares of all integers i such that: 1 <= i <= n The decimal representation of i * i can be partitioned into …

    medium
  • 1706. Where Will the Ball Fall

    Coding

    #Problem You have a 2-D grid of size m x n representing a box, and you have n balls. The box is open on the top and bottom sides. Each cell in the box has a diagonal board spanning two corners of the cell that can redirect a ball to the …

    medium
  • 1352. Product of the Last K Numbers

    Coding

    #Problem Design an algorithm that accepts a stream of integers and retrieves the product of the last k integers of the stream. Implement the ProductOfNumbers class: ProductOfNumbers() Initializes the object with an empty stream. void …

    medium