Ad
  • Custom User Avatar

    Good comment. I've tried to do the same solution, but then, like, wait a minute...what if the test will be not 27 or 153, what if
    the number will be very huge, like 325352952095239525. It will be not optimal solution and take much more time.

  • Custom User Avatar
  • Default User Avatar

    .

  • Custom User Avatar

    (a substring is for example 2:nnnnn or 1:hhh; it contains the prefix)

    The prefix is included.

    1 < 2 < =

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Sudoku is some kind of puzzle. In start you have some small amount of numbers in game field. Your task is to fill the playing field with the rules described above: each line, column, diagonal and "small square" must contain only 1..N numbers without repeating. That is all the game.

  • Custom User Avatar

    Thanks rOg!
    I am learning and I am trying to keep the code clean

  • Default User Avatar

    Well, that all comes down to what your priority is. To me, that is the same argument as "writing". Some people just sit down and "punch the keys" with no editing or holding back to just get it out, and will go back on pass 2 or 3 to start fixing things or refining; while others are "correcting spelling" and refining sentences as they go. In both writing and coding, the latter is a skillset; but there is a debate in both of the pro/con of it. For my self when it comes to both tasks: PASS 1 = just get it done, PASS 2 = clean up what is here, PASS 3 = where I will start to change and refine... PASS 4 to 6 is where I would get around to how clean can this be.

    For example, there was a math puzzle kata on here where my PASS1/2 worked just fine, but it was too inefficient and so it timed out on here. It was 50 lines and a 4 deep loop. Took a sec to do refine of the math of the loops to a var, and then it was one loop and 14 lines (and if I am honest that ver or the further refined 9 line ver of it is what I would put into production). But in "production" all 3 ver and the documentation of them would be on the GIT tree. So for here I only refine as far as the problem forces me to do to pass, and leave the code rawer.

    That would also be why the "terse, comments solutions seem to attract so many best practice votes" is for the skill of "refined". Like you said "Not the best algorithm..." where those harder to read and follow refined ones are often the "the best algorithm". If we are honest, more than one job interview is going to want the "nice how few lines" less is more ver :) But that is not what I am coding for here :P Like you said: "most valuable part, for me at least, is reading everyone else's solutions afterwards". And I love it when the top one is a refined ver of what I just did. Good luck to you to.

  • Default User Avatar

    Thanks, I am getting there. And yes, I do not get the lack of "meaningful names" so you do not have "descriptive variable names". Kind of thought the point was to have it so someone else can follow your code and logic. At this point my main focuse is on solve the problem; but starting to also take the time to see if I can also make it more refined. That is a learning curve, but these Kata are good code practice IMO.

  • Custom User Avatar

    No, after someone has posted a reply, the first post of the thread gets locked.

  • Custom User Avatar

    Use spoiler flag next time.

  • Custom User Avatar

    4kyu and 5kyu katas are harder, not easier.

  • Default User Avatar

    Not a kata issue.