Ad
  • Custom User Avatar

    It's a pleasure to see so clean code! I learn a lot thanks to You. Thanks bro.

  • Custom User Avatar
  • Custom User Avatar

    Good job! My answer was so messy xD

  • Custom User Avatar
  • Custom User Avatar

    OMG, I love your solution! You're very patient

  • Custom User Avatar

    Gosh I feel dumb.

  • Custom User Avatar

    This is an old comment, but just in case someone else is puzzled reading it... The % operator in C and C-based languages like C++, Java and C#, is not a true "modulo operator". It's a remainder from integer division that truncates toward 0, so that nonzero values of x % y will have the same sign as x.

    Many other languages use a remainder from floor division, where nonzero values of x % y have the same sign as y. So n%10 always gives the least positive remainder from dividing n / 10. In this case, that makes:

    -1 % 9 == -1  .... in C, C++, Java, C#
    -1 % 9 ==  8  .... in Python, Ruby, APL 
    

    This problem is one of the rare cases (in my experience) where C-style remainders simplify code. Usually there's no difference, but when there is I find that I have to adjust for the difference more often in C than in Python or Ruby.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    If you study mathematics or like math in general, the math related katas are fun.
    If you are searching for a job or you are about to take a test, you are more stressed to learn and you're interested in the "useful" ones, so math related katas can be annoying in that case.
    I had similar issues in the past. The thing that helped me was filtering katas, on the left part of the screen, select the appropriate tags.

  • Custom User Avatar
  • Custom User Avatar

    Don't forget: Each declared variable needs space in memory (stack or heap). In this kata, you might use three different vars but in real life projects with millions of code and thousands of vars, that solution might be best practise (depends on your team and the concrete project / requirements).

  • Custom User Avatar

    Apparently the computer understands it better if the code is all on one line.

  • Custom User Avatar

    Yeah you are right, that's my bad I apologize. Honestly I was just frustrated because I have a class on SQL coming up so I'm trying to learn it, and I go to do one of these challenges, and find the sql function or w/e that seems like it would do the job, and I plug it in using the same syntax I see on w3schools or wherever I found the info, and the interpreter on here will tell me it doesn't recognize the function or something. That's what I had been doing before this challenge. I wish there was a setting that would not allow me to type anything if my blood pressure rises above a certain level, maybe I should look into that. Clearly there is something I am still doing wrong with the SQL, but it is frustrating. Anyway, just wanted to say that since I'm not able to just delete my comment...

  • Custom User Avatar

    Programming is a very wide field. Yes, you can do alot of programming without much math knowledge, but that is only because you are using a lot of libraries that do the math for you. Somebody has to write all these libraries and they need to know all this "useless math crap". So, please don't be ignorant and recognize the actual usefullness of these katas.
    If you don't want to dive into this sort of programming just skip those katas.

  • Loading more items...