Ad
  • Default User Avatar

    Sure, you can even use a quantum supercomputer if you want; the point of this kata is that clever > brute force!

    There is a clever solution, that I can use with only pen and paper, which will be faster than someone using a brute force solution using NumPy etc.

  • Custom User Avatar
  • Default User Avatar

    Hi @amirymax , thanks for attempting this kata.

    The numbers in the 2 lists are referring to the widths of the N individual columns and the heights of the N individual rows.

    If you focus on a specific column (say it has WIDTH = 5) and a specific row (say it has HEIGHT = 8) then the "intersection" of that column and that row will define a region on the board that has an AREA 5 * 8 = 40.

    It's much clearer if you refer to the N = 5 example on the kata, with the nice picture:

    1. Use the picture to see if you can match my calculations of the areas. For example, moving from left to right on the top row of the example, there are 5 different regions: 1st one is is WHITE and has area = 1x3, 2nd one is BLACK and has area 1x1, 3rd one is WHITE and has area 1x2, 4th one is BLACK and has area 1x7, 5th one is WHITE and has area 1x1.

    2. Repeat this for the entire N = 5 board, on a piece of paper (it's quick), and see if you can find the values: total white area = 146, total black area = 134.