[AtCoder] D - FG operationRead more
[AtCoder] B - Balls of Three ColorsRead more
[AtCoder] A - Gold and SilverRead more
[AtCoder] D - Play TrainRead more
[Codeforces] 2019-2020 ICPC, NERC, Southern and Volga Russian Regional Contest (Online Mirror, ICPC Rules, Teams Preferred) A. BerstagramRead more
[Codeforces] Round #597 (Div. 2) C. Constanze`s MachineRead more
[Codeforces] Round #589 (Div. 2) B. Filling the GridRead more
[Codeforces] Round #585 (Div. 2) B. The Number of ProductsRead more
[Codeforces] Global Round 21 C. Fishingprince Plays With ArrayRead more
[LeetCode] Distinct Numbers in Each Subarray

1852. Distinct Numbers in Each Subarray

Given an integer array nums and an integer k, you are asked to construct the array ans of size n-k+1 where ans[i] is the number of distinct numbers in the subarray nums[i:i+k-1] = [nums[i], nums[i+1], …, nums[i+k-1]].

Return the array ans.

Read more