Write a program to reverse a singly linked list? Modify that program to reverse a doubly linked list.
Technical Microsoft Interview Questions
Explain why manhole covers are round. Why is this design better than, say, a square design.
Imagine you have eight balls, each of the same size.
One of the balls weights slightly more than the other seven.
Using a balance, find the heavier ball using only two weighings.
Write a function to efficiently determine if a linked list has a cycle in it.
Write a function that takes as input a sorted array and modifies the array to compact it, removing duplicates. Also return the new length of the array.
Notes: The input array might be very large.
For example:
- input array =
[1, 3, 7, 7, 8, 9, 9, 9, 10] - transformed array =
[1, 3, 7, 8, 9, 10] - size = 6
Given two arrays of strings, A and B.
B contains every element in A, and has one additional member, for example:
* A = ['dog', 'cat', 'monkey]
* B = ['cat', 'rat', 'dog', 'monkey']
Write a function to find the extra string in B. Do this in O(n)
Express the following table as a static structure, and write a function, find_routes(source, destination) that efficiently outputs all possible routes.
Source | Dest
~~~~~~ ~~~~
Seattle | LA
LA | Florida
LA | Maine
Florida | Seattle
Seattle | Florida
The solution for find_routes('Seattle', 'Florida') should be [Seattle -> Florida, Seattle -> LA -> Florida]
Write a function to efficiently convert a floating point number to a rational number. For example, given 0.125 return "1/8"
Imagine a bear walks the following paths:
- South one mile
- Left turn
- East one mile
- Left turn
- North one mile
The bear arrives at where he started. What color is the bear? Why?
You are given a rectangular cake with a rectangular piece removed. The removed piece is of any size or orientation.
How would you cut the remainder of the cake into two equal halves with one straight cut of a knife?