• + 0 comments

    This is my solution to the Crossword Puzzle challenge. I thought I’d share since I found a fun way to tackle it 🧩 I started by creating a 10x10 grid copy and using a backtracking approach to place each word. First, I split the input words and tried placing them one by one, either horizontally or vertically, in the grid’s free spaces (‘-’). If a word didn’t fit without conflicting with existing letters, I’d backtrack and try a different spot or orientation. Here’s a snippet of how I checked if a word can fit:

    def canPlaceWord(grid, word, row, col, direction): if direction == 'H': # Horizontal if col + len(word) > 10: # Check bounds return False for i in range(len(word)): if grid[row][col + i] != '-' and grid[row][col + i] != word[i]: return False return True else: # Vertical if row + len(word) > 10: return False for i in range(len(word)): if grid[row + i][col] != '-' and grid[row + i][col] != word[i]: return False return True

    Then, I’d place the word, update the grid, and move to the next word, backtracking if I hit a dead end. It took a bit of trial and error, but it felt so rewarding to solve this crossword just like cracking a real puzzle. 📰 I’ve always loved crosswords, and this challenge reminded me how much fun word puzzles can be. As I mentioned, I’ve always been into word puzzles. lately, I’ve been solving the Letter Boxed puzzle from the New York Times each day. It’s become a daily fun routine, and whenever I get stuck or want to double-check my answers at letterboxedanswer.net as they posts clean and spoiler-free solutions. It keeps the streak going without totally giving the game away, which I really appreciate.