Given an array of unique integers, print the array in such a way that the first element is first maximum and second element is first minimum and so on. We have to ...read more
Two-pointer
5 postsGiven a list of n integers and consider another list which has n-1 “<” or “>” operators. Your task is to form a valid sequence by rearranging the initial list such that ...read more
Given an array of size N. The task is to find the maximum and the minimum element of the array using the minimum number of comparisons. Examples: Input : A[]={4,2,-1,5,0,-5,7,3,6} Output : ...read more
Given an array in increasing order and a target, return indices of two numbers such that they add up to the target. You have to return an array of indices where the ...read more
Given a sorted array arr, remove the duplicates in the array itself such that duplicates appear at most twice in the given array arr and print the new length and modified array ...read more