Arcana·Software Engineer·Online Assessment (OA)
Jul 2025
Arcana's OA had a deceptively clean-looking array problem that wrecked me until I found the math shortcut buried inside it. The brute force path is a trap you'll walk right into if you don't stop to think.
- Given an array of up to 100,000 integers (including negatives), count the number of index pairs (i < j) where the pair is considered 'perfect': the minimum of |x−y| and |x+y| is at most the minimum of |x| and |y|, and the maximum of |x−y| and |x+y| is at least the maximum of |x| and |y|.
“Spent way too long on brute force before realizing O(n²) was never going to pass.”