Interview questions
Team Lead/ Tech Lead interview questions – page 6
3,203 questions. Tap “Show answer” to check yourself.
-
Data structure used for proority queue a) linked list b) double linked list c) array d) tree
-
Design a data structure for dequeue that supports the operations deleteLeft, deleteRight, InsertLeft, InsertRight. Write the function DeleteRight ensuring the correctness and synchronisation. All functions may try to modify the dequeue. You can us...
-
Given an array with some repeating numbers. Like 12,6,5,12,6
-
Write a code which will receive as input a matrix (int[][] matrix) and which should find all local maximum from the matrix. A local maximum is such a number in the matrix that is greater than all its immediate neighbors. The method should return t...
-
There is a straight roads with 'n' number of milestones. You are given an array with the distance between all the pairs of milestones in some random Order. Find the position of milestones. Example: Consider a road with 4 milestones(a,b...
-
Design a datastructure to implement a stack such that ALL of push(), pop() and getMax() functions work in O(1) time. You have infinite memory at your disposal. Also note that function getMax() just returns the element with maximum value in t...
-
Find the two numbers whose difference is minimum among the set of numbers.
-
An array contains the set of positive integer. Find the largest number c such that c=a+b where a,b,c are distinct number of the set? [Consider , reducing complexity]
-
An external system has an array. You are given 3 inbuilt functions which perform their operation in O(1) time.
-
1 > Sort the doubly linked list with out swaping the values
-
Given an array and a number K. You have to find out longest subset from the array whose all pair sum will be greater than k. ex: {8,3,4,1,6,2,5,7,9} and K = 12 ans: {8,6,7,9} or {5,7,8,9}
-
GIven an array , find the length of largest sub-sequence such that if the minimum value in this sub-sequence in Min and maximum value is Max then the elements of this sub-sequence should be Min,Min+1,Min+2,..,Max ( in any order )
-
You are given a lot of cuboid boxes with different length, breadth and height. You need to find the maximum subset which can fit into each other. For example: If Box A has LBH as 7 8 9 If Box B has LBH as 5 6 8 If Box C has...
-
How to find out if a point lies inside a triangle or not?
-
Given a number, find 2 numbers in a matrix whose sum gives the number given in ...one pass of the array.
-
Write code for a recursive solution that you created, can be any problem.
-
Write a function that given a list of items and weights return a random item in the list taking the weights into account.
-
Write a function that takes an array of five integers, each of which is between 1 and 10, and returns the number of combination of those integers that sum to 15... For example, calling the function with the array [1, 2, 3, 4, 5] should return 1, ...
-
Given two arrays A & B of length l, containing non negative integers, such that the sum of integers in A is the same as sum of integers in B.( The numbers need not be the same in both the arrays.)
-
Code to find the maximum sum contiguous subarray in an array. Array cam have negative numbers also.
-
Given an array of elements and a value, see that the sum of two elements of an array are equal to the value with minimum loop
-
Given an array and find two numbers in the array having difference equal to given number. you are given that the array is sorted
-
Write efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).
-
Design (classes and class diagrams only) an object oriented Network Library that will facilitate.
-
Given k sorted arrays each of length n, construct a single merged and sorted array.focus on running time and space complexity
-
Given a stream of numbers, design a data structure to store the numbers in the stream along with their no. of occurrences
-
Implement queue using stacks
-
Given an array which contains elements from 1 to n. All numbers present once except following two exceptions: 1) one number is missing 2) one number occurs twice
-
Suppose you want to implement an ADT on a set of integers S with the following operations: insert (k ) - Places k into S extract min(S ) - Removes the smallest element from S extract max(S ) - Removes the largest elem...
-
Algo/data structure for memory manager.