992. Subarrays with K Different Integers
- Manbodh ratre
- Dec 24, 2022
- 1 min read
Brute force Approach
start adding the element into the set from index 0 to last index
For the below example
set values = < 1 >
check if set size = k increase count by 1
count = 1
here i = 0 (index)

i = 1 (index)

i = 2 (index)

i = 3 (index)
set values = [2,3]
increase count by 1
count = count + 1
count = 7
So the final Answer is 7






Comments