All Problems
Problem #86 MEDIUM

The Lazy Librarian's Stack

Amazon Apple Invariants Logic

Problem Statement

A librarian has a stack of 8 books. She can only perform one operation: take any single book from anywhere in the stack and move it to the top. What is the minimum number of moves to sort the stack into alphabetical order, given the current order from top to bottom is: G, C, F, A, H, B, E, D?

Answer & Quick Explanation

Logged-in Users Only

You must be logged in to view the answer and check your solution. Signing up is free and takes less than a minute.

Detailed Editorial Solution

Detailed Editorial Solution is Premium

Unlock detailed step-by-step mathematical proofs, logic explanations, and company-specific interview preparation pathways.