# Category Archives: Searching

I was recently interviewed by Amazon, Bangalore for SDE position. It was an off campus drive in Delhi for TRMS team. Written Test : Q1)… Read More
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:… 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 the highest product. Examples :   Input: arr[] = {1, 4, 3, 6,… 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 Kth largest element at any point of time. Note: Here we have a stream instead of a… Read More
Given an array of integers, find the nearest smaller number for every element such that the smaller element is on the left side. Examples:  Input:… 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