Ad
  • Default User Avatar

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

  • Default User Avatar
  • Default User Avatar

    Make your own version of BigInt class.

  • Default User Avatar

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

  • Default User Avatar

    If you look at the example tests, they show you.

  • Default User Avatar

    not static, called on an object
    since that object is a string, you're looking for google.com/search?q=java+String.trim

  • Default User Avatar

    128 1024 and 4 are some really strange numbers that aren't mentioned in the instructions. those don't belong there!
    not sure how you determine that it returns correct answer. try the test cases in the example tests, find out what your code does by printing out information.
    The first example test case is { 5 8 } and your code runs for about a minute and then crashes.

  • Default User Avatar

    If you print out the input you can solve it manually and compare to what your code does (by printing out step by step what is happening in your code)

  • Default User Avatar

    Pick a test where it fails,
    ("The quick brown fox jumps over the lazy dog.")
    and use print (System.out.println? I do not java) to write out intermediate steps and thereby figure out where things go wrong.
    If it turns out that everything looks fine to you up to that huge boolean expression, then you'll want to break it up into smaller parts.

    Some thoughts:

    • you seem to pass a regexp to String.contains, but that method isn't related to regex, is it?
    • your code is very nested, like it's trying to escape through the right margin. could it be flatter? this isn't in itself important but it usually makes things more difficult
    • because of how your code is nested, most of it won't run ever if there are no upper case characters (the outermost condition)

    A suggestion:
    For each character that you look at, you could print out a verdict, for example
    "Found 'A', seen so far: ['A']"
    "Encountered ' ', ignoring."
    "Encountered already found 'r', ignoring"
    Perhaps your approach wouldn't match those messages, but it's still carrying out steps that can be shown in output to allow you to observe what is being done.

  • Custom User Avatar

    Please use spoiler flag if you're sharing details of the solution from next time.