Tag: Two pointer algorithm
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = , nums2 = Output: Example 2: Input: nums1 = , nums2 = Output: Note: …
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as …
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 …