# Programming Interview Questions

interview questions shared by candidates

## Programming Interview Questions

Binary tree with parent pointers, given two nodes find common ancestor. |

Design an email sender that can send 100,000,000 emails. You have 5 machines how could you do it efficiently. |

Write a program for creating Huffman Coding for a set of characters given its frequency table. |

When did you over-promise to a customer? When did you have to make an unpopular decision? |

Please describe how to implement a function to print out a linked list backwards |

Given a square Grid of numbers, Considering all the numbers at the boundary as 1 layer and numbers just inside as another layer and so on how would you rotate each of the layers of the numbers by a given amount. |

Suppose you have a stack of pancakes of pairwise distinct sizes. You wish to order the pancakes the pancakes by size, with the largest one on the bottom. The only operation is available to you is a spatula flip: You can insert a spatula anywhere in the pancake stack and flip over the stack above the spatula, reversing the order of the pancakes. For instance, in the following stack bottom . 2 3 | 5 1 4 . top Inserting the spatula between 3 and 5 will give: bottom 2 3 4 1 5 | top Design an algorithm to sort the pancake stack using this operation. Write a program to execute this algorithm in C++. What is the runtime efficiency (precisely, not just in Big-O time), assuming that a flip is an atomic operation? Is your algorithm optimal (again, precisely, not just asymptotically)? |

Design a class to process a matrix, and it needs to be able to return the average for the elements of arbitrary sub-rectangle inside that matrix, in constant time. |

You are to write a spell checker. Discuss the API, Data Structures and Algorithms. |

Describe to me in C how to take the word "FOX" and rearrange the words backwords to spell "XOF" using only a stack and one variable. |

**31**–

**40**of

**216**Interview Questions