6 kyu

Find the total white and black areas in a strange chessboard

321 of 664benjaminzwhite
Description
Loading description...
Fundamentals
Algorithms
Puzzles
Mathematics
  • Please sign in or sign up to leave a comment.
  • miguel99 Avatar

    Difficult one, got a bit mad at my first try cause I didn't completely read the description, and was then dumbfounded when I saw the part about solutions with loops inevitably being to inefficient, resulting in timeouts. But then taking a look at the puzzle with a fresh mind I finally got it :)

    Props to the author

  • P M Hegde  Avatar

    This comment has been hidden.

  • P M Hegde  Avatar

    with no loop also this kata is timed out :(

  • susithemafk Avatar

    took so much time, but very great kata. tbh I think it should be like kata 5, maybe less.

  • werwer17 Avatar

    This comment has been hidden.

  • ciuis Avatar

    This comment has been hidden.

  • P M Hegde  Avatar

    This comment has been hidden.

  • amirymax Avatar

    can we use numpy?

  • JohanWiltink Avatar

    LC translation

    This translation changes the description ( LC needs some extra information ).

  • ChichoZeDo Avatar

    Hi There!, I found a solution for this Kata using "product" from itertools package but it is also time out, please help!

  • semki Avatar

    How to optimize nested loops for

    I have the right solution, but its time out

  • JohanWiltink Avatar
  • stellartux Avatar
  • akar-0 Avatar
  • amirymax Avatar

    Hi there. Im really confused about this test [3, 1, 2, 7, 1, 11, 12, 3, 8, 1], [1, 8, 4, 5, 2, 21, 5, 2, 2, 17] where answer = (1583,1700). I dont really get it. Shouldnt we multiply and add the even indeces for white and odd indeces for black? Cause after adding up the i get (89, 297), separately. Please help, author or anyone else.

  • conconTheCoder Avatar

    I have two for loops in my solution, and despite passing all the cases it says that I timed out

  • FArekkusu Avatar

    The performance requirements are not mentioned anywhere.

  • alexbur Avatar

    Thank you. Enjoyed :)

  • Victorlpzv Avatar

    Execution Timed Out

  • Shaun112345 Avatar

    are we aming for O(n) or O(n2) here?

  • rowcased Avatar

    C Translation kumited.

  • FArekkusu Avatar

    Tests allow O(n^2) solutions to pass again.

  • Voile Avatar

    Sample tests should also follow the testing framework usage.

  • Voile Avatar

    There is no point in testing the type and length of returned value as test.assert_equals already does that automatically, and also format and print the returned value.

  • scarecrw Avatar

    This is an interesting kata, but the description is longer than is likely necessary, while still leaving people confused. This is a case where an image can really clear things up. I'd recomend adding the following or something similar, to clarify:

    Created with Fabric.js 4.6.0 3 1 2 7 1 1 8 4 5 2
  • Blind4Basics Avatar

    hi,

    I definitely want to see the full chessboard of the example, because so far:

    • either I don't understand what I'm supposed to do
    • or there is an assumption somewhere I didn't get and this is a purely mathematical problem with actually impossible boards...

    ?

  • FArekkusu Avatar

    The user can modify the input.

  • FArekkusu Avatar

    Input generation is terribly slow.

  • FArekkusu Avatar

    The performance requirements are too lenient.

  • FArekkusu Avatar

    The output type should be a tuple.