What is the worst case time complexity to count pairs of numbers with difference ‘k’ from an input array of ‘n’ numbers
- O(log n)
- O(n log n)
- O(n)^2
- O(n^2 log n)
The answer given was B but since worst case time is stated shouldn't the answer be C? I mean we can check all possible pairs in the worst case. Correct me if I am wrong?