Board Word Hits Problem
Board Word Hits Problem — ExecCode Hard DSA Practice
Solve the Board Word Hits problem on ExecCode. Free online hard DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.
Problem description
A character board hides a dictionary. You may walk 4-directionally without reusing a cell in the same word. Return every word from words that appears on the board, sorted lexicographically. You are given: board — grid of single lowercase letters as strings words — dictionary Return sorted list of found words. Missing words are omitted. Board letters are length-1 strings, not integers.
Examples
Input {'board': [['o', 'a', 'a', 'n'], ['e', 't', 'a', 'e'], ['i', 'h', 'k', 'r'], ['i', 'f', 'l', 'v']], 'words': ['oath', 'pea', 'eat', 'rain']}; Output ['eat', 'oath']. Input {'board': [['a', 'b'], ['c', 'd']], 'words': ['abcb']}; Output []. Input {'board': [['a']], 'words': ['a', 'b']}; Output ['a']
Constraints
Same cell cannot be reused inside one word Different words are independent
Practice Board Word Hits free on ExecCode. Browse DSA problems, topic map, and placement guides.