AT&T interview question

The test was mostly LeetCode-style.