Longest K unique characters substring
Given a string you need to print the size of the longest possible substring that has exactly K unique characters. If there is no possible substring then print -1.
- Time : O(n)
- Space : O(1)
- require constant space
1 | class Solution { |