Shortest Bridge - Leetcode 934 - Python