# Algorithm Interview Questions

interview questions shared by candidates

## Algorithm Interview Questions

Suppose you have 100 GB of data that you want to sort, but you only have 1 GB of memory. How would you sort this data? |

Given a set of non-overlapping integer ranges (1,3) (5,8), etc., and an input integer, what is the best way to organize the data and allow for quick search based on the input, etc. |

We have a pond containing a single bacterium. The number of bacteria double every 5 minutes, and the pond is full of them in 24 hours. If we started with the same pond but two bacteria, how long will it take to fill the pond? |

I was asked two questions. Q 1. You are given two version numbers of a software, like Version 10.3.4 and Version 10.3.41. Write a program to find out which of the version numbers are the latest. If version 1 is latest output -1, if version number 2 is latest output +1 else output 0 if same version. Both the version numbers are taken as string. He also asks to make the program of minimum time complexity as we can. At the end he also asked the difference between an iterative program and one with recurrence and their advantages and disadvantages. Q 2. Given two files with a list of application IDs (or some kind of data) stored in them , write a program to compare the data in the two files and output all the common data found in each. What data structure would you use and why ? Give a minimum time and space complexity algorithm. Why did you choose the particular data Structure or algorithm ? |

Given a string write a function which prints all the subsets of the string. Now make the function to return only unique solutions. For example if they give you "abc" you print out a ab abc ac b bc c Now for the unique solution constraint, if they give you "aba" the output should be: a ab aba b |

Find the Kth hisghest element in a given array. |

Write a function that finds the square root of a decimal number. |

How can you solve n^m efficiently only using +, -, *, /. |

How do you reverse a linked list |

Given two sorted integer arrays, write an algorithm to get back the intersection. |

**41**–

**50**of

**780**Interview Questions