Hackerrank problem solving practice | Crossword Puzzle

FintechCat
1 min readFeb 22, 2020

--

Go on solving one of Recursion series problems in Hackerrank “Interview Preparation Kit”.

This “Crossword Puzzle” problem gives two inputs, one is a grid filled with “+” or “-” and another one is a words array. Required output is new grid which use all words in the array one by one filling all “-” positions in input grid.

Focus on constraint on size of input grid which is limited to no more than 10. So time complexity could be very loose and we could just use brute force to traverse all possible choice to pass it!

Although brute force can be implemented, the solution above use backtracking which is more efficient way.

--

--