Design Algorithm for Longest Substring with K Distinct Characters | Upstart