Ad
  • Custom User Avatar

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

  • Custom User Avatar

    I looked through the existing Java solutions and there are basically two types:

    • One using only String[][] arrays, coming out with 800-1500 characters.
    • One building an FSM and converting to regex which is at 2000-3000 charactes using Maps for the FSM or 3000-5000 characters implementing own types.

    None of them is golfed. Some even have comments explaining the algorithm.

    Of course, this is due to survivorship bias, so longer solutions will exist but are not passing.

    You might want to attempt/test your solution once that I can take a look at it.

  • Custom User Avatar

    Once again, I have no good idea why you focused on the golfing part so hard. There is no need to golf anything if your idea is not totally missed in some way. I am on my phone so its not easy for me to check exact sizes of existing solutions, but id estimate the shorter ones being around 500-1000 chars, long ones (including mine) around 1500-2500 chars, WITHOUT ANY GOLFING.

    You are not asked to golf your code. Theres no need to. You are expected to come up with a good idea for your solution, which for 1 kyu kata is not unreasonable.

  • Custom User Avatar

    The core of my algorithm is about 100 lines (about 5000 chars), excluding data types it needs declared and other boilerplate. I can probably golf everything down to under 5000 chars, but it's stupid to screw up my code in such a way, as it's outside the point of this exercise. Moreover, expecting people to write golfed code in the first place teaches bad and unrealistic practices.

  • Custom User Avatar

    I would say you are doing something wrong. My solution has ~120 lines, and nice solutions have like 50 lines. There is even a C solution which is 4 lines long.

    If you cannot fit into 5k characters, it sounds you need some much better idea.

  • Custom User Avatar

    5,000 characters is an absurdly low limit for a realistic, non-golfed solution to this problem, at least in Java. My solution to this is around 15,000 characters and it has no verbosity or repetition beyond what's typical for a Java program.