The idea is to use a resizable array (ArrayList in Java, vector in C) together with hashing. Resizable arrays support insert in Θ(1)
Category - Hashing
An Efficient Solution is to use the count of previous window, while sliding the window. The idea is to create a hash map that stores elements.
An Efficient Solution is to use the count of previous window, while sliding the window. The idea is to create a hash map that stores elements.
One Solution is to first sort the array and find the longest subarray with consecutive elements. Time complexity of this solution is O(nLogn).
One Solution is to first sort the array and find the longest subarray with consecutive elements. Time complexity of this solution is O(nLogn).
One Solution is to first sort the array and find the longest subarray with consecutive elements. Time complexity of this solution is O(nLogn).
One Solution is to first sort the array and find the longest subarray with consecutive elements. Time complexity of this solution is O(nLogn).
Given an array of integers and a number k, write a function that returns true if given array can be divided into pairs such that sum.
A trick in step 2.b is to use memorization ( Dynamic programming ) while finding number of employees under a manager so that we don’t need to find number.
We can also use hashing to avoid building a graph - Hashing - The idea is to first find the starting point. A starting point would never be on ‘to’ side