Interview questions
Algorithm interview questions – page 13
811 questions. Tap “Show answer” to check yourself.
-
Consider the set of integers 1,2,3,4,5,6,7,8,9,10,11,12,14,15, ...
-
If pairwise sums of 'n' numbers are given in non-decreasing order identify the individual numbers. If the sum is corrupted print -1 Example: i/p: 4 4 5 7 10 12 13
-
There are two systems and transfer a data of 1TB. The hardware is best possible available. Tell the conditions which will optimize the data transfer.
-
Given n players, each player plays against every other player. Result of all the matches are given. Arrange the players in such a way that p0, p1, p2,... pi-1, pi, pi+1, pn, pi+1 won over pi and pi won over pi-1.
-
Given a positive integer N, arrange the integers 1 to N such the position of the average of two numbers (if present) falls outside the two numbers. For example, for a[i] and a[j], if b = (a[i] + a[j])/2, then if a[k] = b, k < i or k > j.<br ...>
-
Order the functions in order of their asymptotic performance
-
Implement your own atoi()
-
Find an effective algorithm for the working of lift
-
A matrix having 0 and 1's. each row is sorted. find least sum row.
-
Given an expression remove the unnecessary brackets in it with out creating an ambiguity in its execution.
-
Write a program to check if a port is open or closed.
-
How to find whether a 10 digit number (non repeated digits) is a perfect square or not? perfect.
-
Write a function to copy a graph
-
Assume you have an array that contains a number of strings (perhaps char * a[ 100]). Each string is a word from the dictionary. Your task, described in high-level terms, is to devise a way to determine and display all of the anagrams with in the a...
-
Given an array A[] and a integer num. Find four no.s in the array whose sum is equal to given num. Brute force :- O(n^4) I solved it in O(n^3) But the interviewer was insisting on a better solution.
-
Given n non overlapping intervals and an element. Find the interval into which this element falls.
-
A file contains millions of 30 bit binary numbers... Write an algorithm to efficiently place the pairs of numbers that are compliments of each other into another file.
-
Print the 100th power of a single digit( which is of type int). How do you maintain that big number in memory?
-
Given a m*n binary array, find largest block of 1's.
-
Given two arrays A and B of size m and n where m is much smaller compared to n. Find out if B contains an anagram of A as a subarray.
-
Given a NXN array, rotate the array 90 degrees counter-clockwise in place.
-
Given a set of points in a plane. Write a function to check if there exists a vertical line of symmetry in this plane.
-
Permutation Function which could print in Sorted Order.
-
You have an array of X elements. You have to find a subset of three elements such that their sum is upto a value Y. Try to do it in O(nlogn)
-
Find the longest common subsequence of given N strings each having length between 0 to M. Can anybody give a good approach to the solutions
-
Write a program to check graph is bipartite or not , what will be the time complexity.
-
n people are seated around in a circle. At each step, the mth person is eliminated from the circle. The next iteration continues from the person next to the eliminated person. In the end, there will be only one person remaining. Given ...
-
Give a sorted array of huge size. The array cannot fit in memory. How would you do binary search in such a array?
-
In a X's and 0's game (i.e. TIC TAC TOE) if you write a program for this give a fast way to generate the moves by the computer. I mean this should be the fastest way possible. T
-
Given a file, write a function that prints all phone numbers in the file.