Write a program to reverse a singly linked list? Modify that program to reverse a doubly linked list.
Ruby Facebook Interview Questions
Write a string to find a substring in a given string. Do this in O(n) or better
Write a function that takes an unsorted integer array, and returns a three element subset whose sum is zero.
Note: This is a special case of the SUBSET-SUM problem. That problem is NP-complete, but we're only looking for subsets of 3 elements. This can be achieved in polynomial time.
Write a function that takes as input a string, and outputs that same string, with any parentheses in it balanced. Do this using the minimum number of edits.
The least common multiple of a set of integers is the smallest positive integer that is a multiple of all of the integers in the set.
Write a function that takes an array of integers and efficiently calculates and returns the LCM.
Write function that takes a binary tree and efficiently returns the Nth smallest element.
For example, if N=4, and the tree looks like:
3
/ \
2 5
/ / \
1 4 6
The function should return 4.
Write a function that takes as input a binary tree, and prints out each level of the tree on a newline. For example:
a
/ \
b c
/ / \
d e f
will output:
a
b c
d e f
Write a function that takes a an array of integers, and returns the contiguous subsequence of integers with the largest sum.