A 10 x 10 Crossword grid is provided, along with a set of words (or names of places) which need to be filled into the grid. The cells in the grid are initially, either + signs or – signs. Cells marked with a ‘+’ have to be left as they are. Cells marked with a ‘-‘ need to be filled up with an appropriate character.
You are also given an array of words that need to be filled in Crossword grid.
Input : +++++++++- -++++++++- -------++- -++++++++- -++++++++- -++++----- ------+++- -++++++++- +--------- ++++++++++ Output : +++++++++C P++++++++H HISTORY++E Y++++++++M S++++++++I I++++MATHS CIVICS+++T S++++++++R +GEOGRAPHY ++++++++++
The approach behind this is to recursively check for each word in the vertical position and in the horizontal position. Then fill the word in the matrix that can be the best fit in the corresponding position of the grid, then update the crossword grid by filling the gap with that word.
1 way to solve the puzzle *J******** *H******** *A****P*** *R#***U#** *K****N*** *H****J*** *A****A*** *N*MUMBAI* *D******** ***MIZORAM Number of ways to fill the grid is 1
- Solve the Logical Expression given by string
- A Sum Array Puzzle
- Egg Dropping Puzzle with 2 Eggs and K Floors
- Program for Chocolate and Wrapper Puzzle
- Programming puzzle (Assign value without any control statement)
- Eggs dropping puzzle (Binomial Coefficient and Binary Search Solution)
- Number of ways to reach (X, Y) in a matrix starting from the origin
- Find the weight at (Xi, Yi) after M operations in a Matrix
- Count of columns with odd number of 1s
- Find the parent of a node in the given binary tree
- Java Program to Calculate Power of a Number
- Generating all divisors of a number using its prime factorization
- Maximum height of the binary search tree created from the given array
- Count number of ways to arrange first N numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.