Category: Two Pointer
Given a string s , find the length of the longest substring t that contains at most 2 distinct characters. Example 1: Input: “eceba” Output: 3 Explanation: t is …
Given a string, find the length of the longest substring T that contains at most k distinct characters. Example 1: Input: s = “eceba”, k = 2 Output: 3 …
Design and implement a TwoSum class. It should support the following operations: add and find. add – Add the number to an internal data structure. find – Find if …
Given an array A of integers and integer K, return the maximum S such that there exists i < j with A + A = S and S < …
Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the …