Count Binary Substrings Leetcode Javascript Question