Stone Interview Question

Resolva esse problema do LeetCode