Quant Memo
Coding/●●●●●

The symbol that dominates the tape

One symbol traded so heavily today that it accounts for strictly more than half of all prints on the tape. Find it using only constant extra memory (a hash-count table would work but is not allowed here).

tape = ["A", "B", "A", "A", "C", "A", "A"]
-> "A"          # A is 5 of 7 prints

Return the majority symbol, assuming one exists. Aim for O(n)O(n) time and O(1)O(1) space.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions