Binary String Problem Leetcode Python