This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
# Function to expand input like "3R1D" into ['R','R','R','D'] | |
def expand_row(row_str): | |
result = [] | |
i = 0 | |
while i < len(row_str): | |
# Get number | |
num = 0 | |
while i < len(row_str) and row_str[i].isdigit(): |