Skip to content

Instantly share code, notes, and snippets.

@Basicfeed
Basicfeed / brick_wall.py
Created October 11, 2025 08:17
TCS CodeVita: Brick Wall Problem Solution
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():