Tiktok First Round 2-1 level
Anonymous User
1219

Not sure how to solve this problem actually...

"""
Given an integer array nums and an integer k, return the length of the longest subarray of s such that the frequency of each character in this subarray is greater than or equal to k.

if no such subarray exists, return 0.

Example 1:

Input: nums = [1,1,1,2,2], k = 3
Output: 3
Explanation: The longest subarray is "1,1,1", as '1' is repeated 3 times.
Example 2:

Input: s = "[1,2,1,2,2,3]", k = 2
Output: 5
Explanation: The longest substring is "1,2,1,2,2", as '1' is repeated 2 times and '2' is repeated 3 times.

Constraints:

1 <= nums.length <= 104
Nuts consists of only integers.
1 <= k <= 105
"""

Comments (8)