Leetcode Breadth First Search Algorithm Javascript Format Integer