- reverse each word in a sentence
- find longest word in a sentence
- given an array of integers find triplets such that a^2 + b^2 = c^2.
- 2 robots land on a planet that only has x coordinate (a line). The robots can only go either left or right. The planet has nothing on it except the parachute that each robot has used. You're asked to program the robot to meet each other in the shortest amount of time. You're only allowed to use if statement and "Go left" and "Go right". The if statement can only contain: if the robot meet each other, or if the robot see its own parachute.
- Write an algorithm to reverse an array? what is the time complexity?
- implement sqrt
- Make a program that writes a Binary Search Tree to a file. Now create a program that reads those files and recreates a Binary Search Tree.
- How would you sort an array if you had infinite RAM? Infinite memory?
- Create a Priority Queue with all methods.
- Write program to print Binary Tree using breadth first search and depth first search
- Given an array of integers, positive and negative. find an interval in that array, whose elements constitutes the maximum sum
- reverse linked list
- recursion to swap binary tree
- Given an array of ints, return the prime numbers of this array.
- Given an array of ints, return any number repeated at least 3 times.
- given a linked list which has two types of pointers, a normal next pointer which points to next element in the list and random pointer which points to random element in the list. Question was to clone this linked list
- Remove all duplicate words from a string of words. Not just the duplicate but all the instances of the duplicates need to be removed.
- How to serialize an array of string? How to deserialize it ?
- Write an algorithm to validate a palindrome
- In place, move the duplicates in an array to the end.
- given a function called drawpoint(x,y) write a function to draw a circle.
- a few questions on what resolves to true and what resolves to false. will 0.5 resolve to true? if you use -0.75 in an comparison statement (if -0.75) what will be returned from that statement. etc... what else can be used as true, what can be used as false.
- Pick out k random elements from a very long linked list
- There are different currencies being used all over the world. In Japan, it is Yen, in America, its $. America has coins in denominations of 1, 5, 10, 25 and 50. Say if the input is 36, then (1+10+25) = 36. So 36 can be got by suing 1 one coin, 1 ten coin and 1 twenty five coin. So for getting 36, I need to use three coins. Write a pgm for that in all currencies of the world.
- you have an array of size N whose contents are either 0, 1 or 2 (repeated, of course). Sort the array in a single pass.
- You have a tree with black and white nodes in it. The goal is to find the longest white path in a tree.
- Given an array filled with 'n' random numbers, each number may or may not be repeated again in the array, (mix of duplicates and unique numbers) shift all non-duplicates to the start of the array. for example, if array is {4,2,17,2,56,2,4} output should be {4,2,17,56...} the remaining part of array can be modified to anything, doesnt matter
- Given a string s of length n and an index i (0 <= i <= n). Using only constant extra space, how do you manipulate the string in-place to yield the string s[i, i+1, ... , n-1, 0, 1, ..., i-1]?
- Pretty printing for polynomial equation
- Given a string of alphabets, convert them inplace to their ascii values
- Find the longest substring among two strings
- Imagine there are n cities (say c1, c2....cn) connected circularly and each of them has a petrol bunk (say p1,p2...pn). The distance between each cities are d1, d2...dn. Here 1unit of petrol will be used to travel 1unit of distance. You can start from any city so that you can go through all of them and reach the same location (city). Find from where we've to begin the navigation.

FOR EXAMPLE:

c1-->c2-->c3-->c1

p1 has 2ltr

p2 has 10ltr

p3 has 4ltr

and the distance between each cities:

c1<-->c2: 3

c2<-->c3: 2

c3<-->c1: 8

Here we've to start at c2 in-order to come back again to the same place.

Explain the logic to find whether u can come back to the same location. Find where to start. Write a program for the same. Write test cases for the same.

- You're converting a string (s1) into another (s2) by changing the characters in s1. You can do add/delete/replace the characters of s1 to get s2. The cost of any of those operation for a character is 1. Find the minimum cost to convert s1 into s2. Write program and test cases for the same.

For example: Convert "Hi" into "Hey". This would require minimum two cost.

1. Replace 'i' with 'e' in s1

2. Add 'y' to s1.

Now we've s2

- Write a program to iterate through a 2D grid in a spiral way. Since I can't attach images here, I'll explain it using an array. Imagine you've a nxm matrix of bytes. you've iterate through it in a spiral way. It means, iterate the first row (left to right), then iterate through the right most column (top-bottom) then iterate the bottom most row (right-left) until you reach the center of the matrix. Hope its clear now.
- You've a singly linked list where every node in the list has a field "random" which points to other node in the same list. Write a function to clone this list (create a new copy of the same). Don't use extra space (just the pointer variables are fine).
- Given a BST and a range, print all the numbers that comes in that range.

Ex: the function will be something like: print(node * head, int x, int y);

- It has to print all numbers within the rage x&y
- Print max height (level) of a binary search tree.
- Given an array of integers, determine the sub array which makes max sum.
- Find LCA of the binary search tree.
- There is a long contact list in a mobile phone storing Name and other details. Your task is to give the data structure and algorithm for efficient searching among the contacts. As the user types the letters in the text field, the screen should show all the names beginning with those letters (of either first or last name or any other word in the name).
- Find the 20 longest strings in a text file.
- Write a function that puts 2 unordered arrays into a 3rd order array
- How to write a string class
- How to test a file IO save solution (example was the save/load for excel)
- How to write the string to float function atof()
- Stack to queue
- Find all words the input numbers on a phone may represent
- Given some hardware, design and code a file system (of course, very high level).
- convert a binary search tree to double linked list.
- Given a 32-bit integer, return a list of all bit positions of that integer that are set to 1.
- deep copy a graph
- find all palindromes in a string.
- how to optimize the memory in finding the frequency of some number in the given long array
- how to use bst to find the exact number
- N-Queen problem
- A Maze is given as N*N binary matrix of blocks where source block is the upper left most block i.e., maze[0][0] and destination block is lower rightmost block i.e., maze[N-1][N-1]. A rat starts from source and has to reach destination. The rat can move only in two directions: forward and down.

In the maze matrix, 0 means the block is dead end and 1 means the block can be used in the path from source to destination. Note that this is a simple version of the typical Maze problem. For example, a more complex version can be that the rat can move in 4 directions and a more complex version can be with limited number of moves.

- given a data structure .one node with 2 pointers.. determine whether it is a doubly linked list , tree or nothing
- Swap nodes of a linked list.
- Implement a class that lets you define user defined data types (the class should let the user input the number of bits and it should construct a data type having that many number of bits )
- Given a tic-tac-toe board determine of it had a winner or not
- Design Minesweeper Game
- A general discussion on how to decide aspect ratio and how to determine scroll bar is to text it covers ratio for different monitor sizes ,
- given two nodes in binary tree , how to determine if two nodes are adjacent or not ,
- Create a data structure that minimizes time complexity of retrieving median and inserting new element. Getting median should be O(1) and insertion should be O(log(n)).
- string compression: aaabbbbcc ->a3b4c2
- You have two linked lists that merge at some node. The lists could be billions of nodes long. Find the node where the lists merge in the most optimal time while using a low amount of memory.
- Write an algorithm to separate all zeroes and ones in an array
- Write an algorithm to find the depth of a binary tree
- Remove a node from Linked list when address of same node is given
- Split the given linked list into two based on given key - one list containing numbers greater than the key and the other one lesser than it.
- Remove duplicates in unsorted linked list.
- Print the matrix helictically
- Implement the circular queue using array
- Find whether there exist a path in binary tree whose sum is equal to given number.
- Optimize it if you know that elements in tree are all positive
- Test the elevator
- Given Binary tree. Find the maximum balance binary subtree of the tree.
- If from 0 to 9, each digit represents set of characters like

0- {a,b,c}

1-{d,e,f}

…

...

like that total 30 characters. write program for a given number ex:945690123. print all possible strings we can form replacing with characters from above set.

- Given the coordinates of the buildings as (Si, Ei, Hi) represent start, end, height of building. Write program to print the set of (Xi, Hi) coordinates to draw the skyline of the buildings.
- How do you design in windows to add an extra attribute to files and design such a way to get the search of the file based on that attribute should be efficient.
- How do you sort a linked list using the most efficient algorithm?
- what is method overloading and overriding? Difference? Give examples.
- Describe the accessibility modifier "protected internal"
- What is interface? Give me an example of using interface.
- What is thread? Write code sample for a simple thread.
- What are the differences between value types and reference types? Give examples of value types and reference types.
- Check if a string is a palindrome.
- Find the intersection point if two linked list
- Given coordinates, check if a drawing a triangle is possible.
- Binary tree pre-order traversal without recursion.
- how to determine if 2 linked lists are merged at a common node in O(n) time
- construct a data structure that, given a dictionary of words, can form all words while traversing a "boggle grid"
- Print the binary tree in zig-zag order.
- Write a function to determine if a binary tree is balanced or not.
- Write a function to convert a number in Roman numeral form to a decimal representation.
- Write a function to print out the contents of a singly-linked list in reverse order.
- Write a function to find the location of k consecutive 0's in a bitstream of length n
- Write a function to solve a problem given one set of constraints, then, changing some (but not all of) the constraints, decide how you will change your function, and see if that function still handles the initial set of constraints.
- Find count of unique characters in a given string
- find median of two sorted arrays
- In a sequence of alphabets (like aaabbddaabbcc) write a program to find the number of the consecutive alphabets in and print the alphabet and number. example :if input is aaabbddaabbcc then output should be 3a, 2b, 2d, 2a, 2b, 2c
- Write a program to find out in a sorted array the sum of any two numbers present in the array is closest to the a number given. if you have an array 4, 6, 8,24,36 and the given number is 31 then output should be 24 + 6 = 30
- Sort a list of numbers in ascending order using two stacks
- How to detect the starting point of loop in a linked list which has a loop
- Consider n people with random birthdays. How large does n need to be before there is at least a 50% chance that two people have the same birthday?
- Sort in linear time but without extra space as in counting sort
- Given an integer, write a function that rotates the digits to the right.
- You have a building with 100 stories. You also have two glass balls. You can drop the glass balls as many times as you want before they break. How can you find the floor at which they start breaking with the fewest number of drops?
- Print Level order of Binary tree.
- Prove that there will only one tree possible from a given In-order and Pre-order.
- Some thread and virtual memory related questions. Answer Question
- Iterative In-order, Post-order and Pre-order. bonus points if you are not using extra space.
- Implement a Tic Tac Toe game to be played between a user and a computer.
- N people are sitting in a circle labelled 1 through n. They being counting 1,2,3,.... in a clockwise manner and every person that gets a number divisible by 3 is eliminated. Write a program to figure out which numbered person will remain. What's the time and space complexity?
- Questions on object oriented programming concepts such as polymorphism, multiple inheritance, and virtual functions.
- Model the animals in a zoo and draw the class diagrams. Questions regarding when it's right to inherit from a class as opposed to adding a property in the current class, and so on. When to use multiple inheritance, which classes should be abstract, etc.
- Implement a solution to the shortest path problem in a weighted directed graph. (Obviously, the question wasn't framed like this, they gave me a map of cities with distances and asked how to get from city A to city B with the smallest distance traveled, and then to write code for it)
- Write a method that finds all the unique unsorted combinations of a unknown element list without using any loops.
- Write a function that finds all the times a clocks hours and minutes hand are at 90 degrees.
- Write a function that reverses the letters in each word using only one char buffer. E.g.: "I work at Microsoft" to "I krow ta tfosorciM"
- Discuss how a queue works and how to add and remove items from the queue.