filmov
tv
Find the Pair with given sum in the array | count the Pairs | Data structure | Algorithms | Java

Показать описание
Find the Pair/Pairs with given sum in the array three different approaches discussed: for e.g:
array= {2,4,5,1,6,4} , sum=10
Pair we have is {6,4}.
a) Brute Force Time complexity: O(n^2)
b) Sorting Time complexity: O(nlogn)
c) Hashing Time complexity: O(n)
Interview question asked in Google | Microsoft | Uber.
#Array #sorting #hashing #java #leetcode
array= {2,4,5,1,6,4} , sum=10
Pair we have is {6,4}.
a) Brute Force Time complexity: O(n^2)
b) Sorting Time complexity: O(nlogn)
c) Hashing Time complexity: O(n)
Interview question asked in Google | Microsoft | Uber.
#Array #sorting #hashing #java #leetcode