Skip to content
Related Articles

Related Articles

Twitter Interview | Set 1
  • Difficulty Level : Medium
  • Last Updated : 28 Apr, 2017

Phone screen – I

1. Fibonacci series without using an array – this is a typical favorite question w.r.t. Dynamic Programming where you will asked not to use Memoization or any extra storage to store the values of the previous iterations.
(More complicated version of the same problem: Generate Nth row of pascal’s triangle w/o using a 2D array of dimention N x N)

2. N-ary tree : find if a node exists in the tree with value = x. If yes, return true, else, return false.

Phone screen – II
1. Find the lowest common ancestor of Binary Tree
Answer: Done it a 10 times πŸ™‚ Explained how to do it !

2. Clone a graph and analyze the time and space complexity (since DFS based approaches leverages smaller time at the cost higher memory)

public class Node {
   public int data;
   List neighbhors;

   public Node (int data) {…}
   setNeighbors(List neighbhors) {…}

// HashMap created = new HashMap();

public Node clone(Node oldGraph) {

  if (created.get(oldGraph))
    return created.get(oldGraph);

  Node newGr = new Node(;
  List nbors = new ArrayList();

  created.put(oldGraph, newGr);

  List adj = oldGraph.getNeighbhors();
  for (Node n : adj) {

  return newGr;

Phone Screen III

Design a bloom filter to remove the duplicates from an unsorted array !


1. (Boggle – like question) In a 2D array (M x N, in the given ex. 3Γ—3) of numbers, find the strictly increasing path from the specified origin cell (1,0) to the specified destination cell (0, 2). Array may contain duplicates, and solution should work with the dups.

2.a. Design a unique hash function for every tweet in Twitter which will be used as part of a service.
2.b. Find if a directed graph has cycles or not. Write a function with boolean return type for the same.

3. Casual Lunch interview.

4. Pattern matching using patterns containing chars (a to z) and β€˜*’ , β€˜?’ and β€˜.’

5.a. Describe how would you do external sort -> come to a map-reduce kind of solution. Each machine has 10M numbers (total 100M), 10 total machines. Each m/c has 20MB RAM and 50GB memory.
5.b. N-Queens problem: find and print all possible non-conflicting positions for the Queen.

6.a. Given an input binary tree and reference to a Node in the tree, find next in-order successor for the input node. Output null if none.
6.b. What is the best way to sort a k-sorted array ? Optimize for time complexity.
(My hint: use a priority queue of size k)

7.a. Hiring manager: Design a service for a. Durability b. Consistency
7.b. Explain C++’s problem with multiple inheritance.

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.   In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.

My Personal Notes arrow_drop_up
Recommended Articles
Page :