Turn
4.9 of 5
www.turn.com Redwood City, CA 150 to 499 Employees

# TurnEngineering Interview Question

I interviewed in Redwood City, CA and was asked:
"You have a stack of pancakes, listed with numbers. The length of each pan cake depends on the number. So pancake labeled 2 is less than pancake labeled 10. | 1| ------- | 2 | ------------ | 10 | ------------ | 7 | ---------- -- | 8 | ----------- | 3 | You are given a "flipper" which can be used to flip pancakes, in a way that ALL pancakes above the flipper can be overturned. So in the diagram above, You can use the flipper to make 1, 2, 10 into 10,2, 1. You can flip the entire stack to give you 3,8,7,10,2,1 How would you make the above stack of pancakes into ascending order using the flipper? pancakes should be stacked as 1,2,3,7,8,10, so 1 is at the top and 10 is at the bottom."

Part of a Engineering Interview Review - one of 29 Turn Interview Reviews

5
of 6
The key is to work from the bottom up. So start by getting 10 on the bottom and then work up the stack till they are all in order.

So now if we are trying to get 10 on the bottom we need to first get 10 on top and then flip the stack.

*use | to represent flips
step 0 : 1 2 10 | 7 8 3
step 1 : 10 2 1 7 8 3 |
step 2 : 3 8 | 7 1 2 10
step 3 : 8 3 7 1 2 | 10
step 4 : 2 1 7 | 3 8 10
step 5 : 7 1 2 3 | 8 10
step 6 : 3 2 1 | 7 8 10
step 7 : 1 2 3 7 8 10
DONE
- Peter on Oct 7, 2011 Flag Response

### Turn – Why Work for Us?

Turn has been transforming the way Fortune 1000 marketers and their agencies make decisions since we started doing business in 2006. Turn is: • The largest independent company in the advertising technology sector and…

Provided by employer [?]

### Salaries by Company

Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at Turn interview questions and advice. All interview reviews posted anonymously by Turn employees and interview candidates.