Gamified challenge · Asked in Accenture
Each bubble holds an arithmetic expression like 15 - 11 or 2 + 3 * 4: whole numbers and + - * / separated by spaces, with the usual precedence (* and / first). Every division is exact and no two bubbles have the same value.
Write popOrder(bubbles) (pop_order in Python) that returns the bubble indexes in ascending order of value. For ["15 - 11", "15 / 5", "2 * 1"] that's [2, 1, 0] (2 < 3 < 4).
Accenture's round games are free with an account: write your answer in Java or Python, watch it play out, and step through the algorithm.
Sign in with Google