Find pair of numbers in an array with a given sum

Mahfuzur Rahman
2 min readAug 21, 2020

There are multiple ways to find the pair of numbers in a given array. The numbers in the array can be in two ways.

  1. Sorted
  2. Unsorted

If the numbers are sorted then we can get easily with the complexity of O(n). The brute force approach will be easily applicable for both the sorted and unsorted array of numbers.

Brute force:

Brute force approach will check each and every number to determine if it equals to the given sum. The complexity of…

--

--