Skip to content

Latest commit

 

History

History

number-of-unique-flavors-after-sharing-k-candies

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

< Previous                  Next >

Related Topics

[Array] [Hash Table] [Sliding Window]

Hints

Hint 1 For every group of k consecutive candies, count the number of unique flavors not inside that group. Return the largest number of unique flavors.
Hint 2 When calculating an adjacent group of k consecutive candies, can you use some of your previous calculations?
Hint 3 Use a sliding window where the window is the group of k consecutive candies you are sharing. Use a hash map to store the number of candies of each type you can keep.