Skip to content

Category Archives: Searching

Paytm Hiring Drive for Backend Engineer. The selection process was completed on the same day. Round 1 ( Written ): It was a technical written… Read More
Given a sorted array arr[] of size n and an element x to be searched in it. Return index of x if it is present… Read More
A rational is represented as p/qb, for example 2/3. Given a sorted array of rational numbers, how to search an element using Binary Search. Use… Read More
Given an array, find an element before which all elements are smaller than it, and after which all are greater than it. Return the index… Read More
Given three sorted arrays A[], B[] and C[], find 3 elements i, j and k from A, B and C respectively such that max(abs(A[i] –… Read More
Given an array where difference between adjacent elements is 1, write an algorithm to search for an element in the array and return the position… Read More
Given an array with all distinct elements, find the largest three elements. Expected time complexity is O(n) and extra space is O(1). Examples : Input: arr[]… Read More
Given an array where all elements appear even number of times except one. All repeating occurrences of elements appear in pairs and these pairs are… Read More
Given a sorted array in which all elements appear twice (one after one) and one element appears only once. Find that element in O(log n)… Read More
Given an array with both +ive and -ive integers, return a pair with highest product. Examples :   Input: arr[] = {1, 4, 3, 6, 7,… Read More
Given a text txt[] and a pattern pat[], write a recursive function “contains(char pat[], char txt[])” that returns true if pat[] is present in txt[],… Read More
Given an infinite stream of integers, find the k’th largest element at any point of time.Example:  Input: stream[] = {10, 20, 11, 70, 50, 40,… Read More
Given an array of integers, find the nearest smaller number for every element such that the smaller element is on left side. Examples:  Input: arr[]… Read More
Recently, I was interviewed for Amazon SDE-1 Position. There were two telephonic rounds followed by 4 F2F rounds. Telephonic Round 1 : ————————— He seemed… Read More
Given an unsorted of distinct integers, find the largest pair sum in it. For example, the largest pair sum in {12, 34, 10, 6, 40}… Read More