## Sample Technical Interview Questions - Set 1 (11 Questions) (Pages 71)

• Q1: Print all anagrams of a given string
• Q2: Print matrix in spiral order
• Q3: Delete n digits from a number such that the result is the minimum number
• Q4: Combine two sorted singly linked lists
• Q5: 9 Marbles and weighing machine
• Q6: 3 buckets and apples and oranges
• Q7: Max of two numbers without using any branching, if-else, loop and conditional operators
• Q8: Finding equillibrium index
• Q9: Frog trying to cross river over falling leaves (no solution to this question)
• Q10: Given two keys K1 and K2, print all the values in the range K1 and K2 from a given BST
• Q11: Celebrity problem

## Sample Technical Interview Questions - Set 2 (11 Questions) (Pages 66)

• Q1: Root to leaf path equal to a given number n.
• Q2: Print all pairs of anagrams in a given array of strings.
• Q3: Level order traversal of a tree.
• Q4: Given an array of words, print all anagrams together.
• Q5: Convert a given tree into a sum tree.
• Q6: Delete middle element of a linked list.
• Q7: Convert a binary tree into a circular double linked list.
• Q8: Print nodes at K distances from the root.
• Q9: Even occuring elements in an array of limited range.
• Q10: Print first n numbers with exactly two bits set.
• Q11: Find the element in an array that appears once.

## Sample Technical Interview Questions - Set 3 (9 Questions) (Pages 75)

• Q1: Find the maximum repeating number in O(n) and O(1) extra space.
• Q2: Anagram substring search (or search for all permutatins)
• Q3: Remove all duplicates from a given string.
• Q4: Flattening a linked list.
• Q5: Rearrange a given list so that it consists of alternating min-max elements.
• Q6: Design a tiny URL or URL shortener.
• Q7: Convert a given number to words.
• Q8: Longest even length substring such that sum of the first and second half is the same
• Q9: Find the excel column name from a given column number.

## Sample Technical Interview Questions - Set 4 (9 Questions) (Pages 83)

• Q1: Rotate square matrix in-place by 90 degrees.
• Q2: Array rotation (5 methods)
• Q3: Snake and Ladder problem: minimum number of throws required to reach the last cell.
• Q4: Finding the number of islands.
• Q5: Stepping numbers (2 methods)
• Q6: Print all possible words from phone digits.
• Q7: Square root of an integer.
• Q8: Find two missing numbers (3 methods)
• Q9: Find the missing number (2 methods)

## Sample Technical Interview Questions - Set 5 (10 Questions) (Pages 66)

• Q1: Boundary traversal of a binary tree.
• Q2: Lowest Common Ancestor (LCA) problem.
• Q3: Reverse level order traversal.
• Q4: Level order traversal in spiral form.
• Q5: Implement Queue using stacks.
• Q6: Intersection of two linked lists.
• Q7: Determine if two trees are identical.
• Q8: Detect cycle in a directed graph.
• Q9: Clone a linked list where each node has next and random pointer.
• Q10: Check if two nodes are on the same path in a tree.

## Sample Technical Interview Questions - Set 6 (12 Questions) (Pages 107)

• Q1: Sorted Linked List to Balanced BST
• Q2: Construct a binary tree from a given parent array representation.
• Q3: Height of a binary tree represented by parent array.
• Q4: The bedlam in the party (BFS solution)
• Q5: Connect the nodes at the same level in a tree.
• Q6: Merge two sorted linked lists.
• Q7: Delete the middle of the linked list.
• Q8: Find the intersection point of two linked lists.
• Q9: Reverse a linked list (recursive and non-recursive)
• Q10: Check whether circular linked list or not.
• Q11: Detect loop in a linked list.
• Q12: Detect and remove loop in a linked list.

## Sample Technical Interview Questions - Set 7 (10 Questions) (Pages 64)

• Q1: Check if a tree is balanced or not.
• Q2: Diameter of a binary tree.
• Q3: Delete a node in a linked list when the head of the list is not given.
• Q4: Maximum width of a tree.
• Q5: Convert to mirror tree.
• Q6: Program to check if a binary tree is BST or not.
• Q7: Sorted insert for circular linked list.
• Q8: Merge two sorted linked list in reverse order.
• Q9: Sort a linked-list of 0s, 1s and 2s.
• Q10: Pairwise swap elements of a given linked list by changing links.

## Sample Technical Interview Questions - Set 8 (10 Questions) (Pages 89)

• Q1: Reverse a linked list in groups of a given size.
• Q2: LRU implementation
• Q3: Calculate pow(x, n)
• Q4: Modular exponentiation
• Q5: Find the numbers from an array containing (2*n+2) positive numbers.
• Q6: Find subarray with a given sum.
• Q7: Reverse words in a given string.
• Q8: Find the minimum element in a sorted and rotated array.
• Q9: Find if two rectangles overlap.
• Q10: Check whether a given point lies inside or outside a polygon.

## Sample Technical Interview Questions - Set 9 (10 Questions) (Pages 100)

• Q1: Check if a number is a multiple of 3
• Q2: Find the position of the only set bit
• Q3: Design a website hit counter.
• Q4: Maximal subarray problem (Kadane's algorithm)
• Q5: Move all zeroes to the end of the array.
• Q6: Sum of absolute differences of all pairs in a given array.
• Q7: Find the next greater number with the same set of digits.
• Q8: Lexicographically next permutation.
• Q9: Search an element in a sorted and rotated array.
• Q10: Find the duplicates in O(n) time and O(1) extra space in an array containing elements from 0 to (n-1).

## Sample Technical Interview Questions - Set 10 (10 Questions) (Pages 170)

• Q1: Computational complexity of finding the nth Fibonacci number.
• Q2: Count the number of occurrences of an element x in a sorted array in O(log(n))
• Q3: Given a matrix of distinct values and a sum, find pairs with a given sum such that elements of the pair are in different rows.
• Q4: Trapping the rain water (given an elevation map)
• Q5: Left view of a binary tree.
• Q6: Find the kth smallest element in a BST.
• Q7: Count the number of ways to reach the nth stair.
• Q8: Find the plus (+) pattern of maximum size in a 2D array of 1s and 0s.
• Q9: Minimum cost path (dynamic programming solution)
• Q10: Check if two linked lists merge. If so, where.

Sample Technical Interview Questions - Part 1