2553. Separate the Digits in an Array
Given an array of positive integers nums, return an array answer that consists of the digits of each integer in nums after separating them in the same order they appear in nums.
To separate the digits of an integer is to get all the digits it has in the same order.
- For example, for the integer 10921, the separation of its digits is [1,0,9,2,1].
2558. Take Gifts From the Richest Pile
You are given an integer array gifts denoting the number of gifts in various piles. Every second, you do the following:
- Choose the pile with the maximum number of gifts.
- If there is more than one pile with the maximum number of gifts, choose any.
- Leave behind the floor of the square root of the number of gifts in the pile. Take the rest of the gifts.
Return the number of gifts remaining after k seconds.
2526. Find Consecutive Integers from a Data Stream
For a stream of integers, implement a data structure that checks if the last kvalue.
Implement the DataStream class:
- DataStream(int value, int k) Initializes the object with an empty integer stream and the two integers value and k.
- boolean consec(int num) Adds num to the stream of integers. Returns true if the last k integers are equal to value, and false otherwise. If there are less than k integers, the condition does not hold true, so returns false.
2447. Number of Subarrays With GCD Equal to K
Given an integer array nums and an integer k, return the number of subarrays of nums where the greatest common divisor of the subarray’s elements is k.
A subarray is a contiguous non-empty sequence of elements within an array.
The greatest common divisor of an array is the largest integer that evenly divides all the array elements.
2439. Minimize Maximum of Array
You are given a 0-indexed array nums comprising of n non-negative integers.
In one operation, you must:
- Choose an integer i such that 1 <= i < n and nums[i] > 0.
- Decrease nums[i] by 1.
- Increase nums[i - 1] by 1.
Return the minimum possible value of the maximum integer of nums after performing any number of operations.