Ad
  • Custom User Avatar

    Could you ask that question directly on a solution you don't understand? That makes things easier to explain. Ask questions that are as specific as possible; tell us what syntax you understand and what you do not.

  • Custom User Avatar

    realDenom is being computed with the wrong value. The common denominator of all pairs should still be obtained correctly, but not necessarily simplified.

  • Custom User Avatar

    Are p and q similar to each other?

    No, so when reaching the right-most p, you jump out of surface, even if there is another q to your right. Equivalent for q in other direction.

  • Default User Avatar

    it does require a lot of code, but there is no difficult algorithm to come up with, you have a list of rules that translate relatively straightforwardly to code. as long as you are organized, you will make incremental progress and eventually succeed. in constrast, higher-ranked katas often require you to devise a complex algorithm, make some research, optimize your code and so on, things on which you can get stuck for a long time without making any progress until you have a sudden inspiration or make a discovery.

    Another problem is that it is inherently hard to evaluate the difficulty of something. proficient people will tend to underrank, beginners will tend to overrank. And specifically on Codewars, ranks cannot be changed after approval, and there has been a continual rank deflation over the years (kata tend to be ranked lower and lower, i.e. higher kyu)

  • Custom User Avatar
  • Default User Avatar

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

  • Default User Avatar

    我使用for显示超时

  • Default User Avatar

    god bless you)

  • Custom User Avatar
  • Custom User Avatar

    omg, thanks for explaining

  • Custom User Avatar

    Thank you lmao.

  • Default User Avatar

    You can do it, but it's usually more common to iterate array.. to manipulate local variables and considerer this like condition to stop is more like the While ..