Leetcode Two Pointer Approach Python Snake