Home Blog

Array is the sequential collection of similar elements. Array is a fixed size data structure. Arrays can be accessed by index which starts from zero. Reversing the array helps in arranging the all the elements of an array like we are reading elements from the end. We have to write a C++ program to reverse the given array.
Given an...

Given an array of integers (positive and negative numbers) and you have to find a triplet (3 elements) in array whose sum is equal to zero
OR
Find a triplet in an array whose sum is equal to a given input number. Find 3 elements from array whose sum is zero.
Example 1: Given array of integers is let
Input Array: 1, 5,...

Write a program to find a pair sum in array equal to given input number.
Find pair of elements from an array whose sum is equal to a given number X
Time Complexity: O(NlogN)
Space Complexity: O(1)
Concept:
Let say there are numbers below and we need to find 2 numbers from an array whose sum is equal to 17
-1 5 7 -8 12 16 -30...