Interview questions

Algorithm interview questions – page 12

811 questions. Tap “Show answer” to check yourself.

  1. Given a number n, write a function that would put commas after every third digit from the right to left.

  2. Given a set of coin denominators, write a function to nd the minimum number of coins to give a certain amount of change.

  3. Function for subtraction of 2 base 13 numbers

  4. You have a digital clock having 24 hr format of HH:MM:SS. You have to find following probabilities: 1- Occurence of a particular value(let say 05) in SS 2- As 1st point we have to find probabilities for particular value in hour and min...

  5. What is Heap Sort? When do we apply it?

  6. Find the maximum size Binary search tree in a binary tree?

  7. Consider the following procedure: f(n) for i=1 to n dp j=n while j>i do j=j-1 end while end for Assume the above procedure are only an integer n>0; What is the time complexity...

  8. Given a binary tree, check if it has any two leaves which differ by more that one level.

  9. Write An algorithm for radix Sort , List out the possible application of this sorting algorithm. write clean & efficient program

  10. Given a binary matrix of N X N of integers, you need to return only unique rows of binary arrayseg:

  11. Given a binary search tree, design an algorithm which creates a linked list of all the nodes at each depth (eg, if you have a tree with depth D, youll have D linked lists).

  12. How to count total number of occurrences of a word in a given file. If the file is too big, then how would you do it?

  13. Write a code to find the shortest path in a given graph.

  14. Given a Integer Array of length N, find the absolute difference of every pair of elements in the array. Do it faster than O(N^2)

  15. Print the nodes of binary tree in on sorted order

  16. Swap two variables without using third variable. Do it with different techniques and compare them.

  17. We have a stream of incoming numbers. How will you output the fist n smallest numbers. how will you store them?

  18. There is an array of size 50 that is expected to contain all the numbers from 1 to 50 (every number occuring only once). But there is one number in the array that doesnot satisfy this condition i.e. one number is either duplicate or outside 1 to 5...

  19. Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for abcabcbb is abc, which the length is 3. For bbbbb the longest substring is â..

  20. Given a polygon and a point, how would you find out whether the point is inside the polygon or not.

  21. You have a big screen array containing pixel values at each points. You want to implement cut and paste functionality, of a rectangular sub-block from one place to other inside this big block. How do you go about implementing such a function? </...

  22. How QuickSort is good in Virtual Memory Enviroment ?

  23. Given a list of machines where each machine has a hard disk limit and memory capacity and given a list of processes where each process requires certain hard disk space and memory, write an efficient algorithm to match processes to machines. (You m...

  24. You are given n ropes,maybe of different length. the cost of tying two ropes is the sum of their lengths.Find a way to tie these ropes together so that the cost is minimum.

  25. One irregular shape is given, provide algo to divide in multiple triangles.

  26. Given a binary matrix, find out the maximum size rectangular sub-matrix with all 1

  27. Write a program to generate the Dyck Word from given string.?

  28. Let's say you have a phrase without any spaces - eg. "thisisawesome". Given a dictionary, how would you add spaces in this string?

  29. You are given n Matrices and you have to multiply them, So what you have to do is to minimize the number of product while multiplying them all.

  30. Find all combinations of telephone#

Companies that ask Algorithm questions