Skip to content

Files

Latest commit

9987a3c · Mar 6, 2018

History

History

238-code-combinations

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 6, 2018
Mar 6, 2018
Mar 6, 2018
Mar 6, 2018

Code combinations

Challenge Description:

You definitely know the game where you have to make as many words from the given letters as possible. In our case, the rules are a bit different: you need to check whether it is possible to make the word 'code' with the four given letters, and, if possible, count how many times you can do this. Letters can be in a various order.

Solution example:

| * * * * |
| * c o * |     | c o |  =  1
| * d e * |     | d e |

Input sample:

The first argument is a path to a file. Each line includes a test case with symbol matrix. Each line of the matrix is separated by a pipeline '|'.

**** | *co* | *de* | ****
codx | decx
co | dx

Output sample:

You need to calculate and print a number that will tell how many times you can make the word ‘code’ from the letters in the matrix, using a 2x2 submatrix.

1
2
0

Constraints:

  1. The number of rows or columns in the matrix can be from 2 to 10.
  2. Matrix can include one face for 2 solutions in case.
  3. | c o d x |     | c o |     | o d |  =  2
    | d e c x |     | d e |     | e c |
  4. The number of test cases is 40.