ctci 3.6

Using one extra stack, O(n2) time
else use two extra stack and O(nlogn) time