Jan 2, 2026Everyone uses a HashSet for LeetCode 961. I found a way to use O(1) space by hacking Moore's Voting Algorithm. Here is the math behind it.PRANAY JAISWAL