Ad
  • Default User Avatar

    This code is very easy to read, but I don't think it qualifies as best practice. For every character in the string, 'cnt' is checked to be less than zero. However, that check only needs to be applied when the character is ')'. For large strings, this solution will not be as efficient.

  • Default User Avatar

    I had not considering using lambda.

  • Default User Avatar

    With 6 seconds of time for the thread, it may be an extra challenging to try a genetic algormithm. Perhaps, impossible....

  • Default User Avatar

    Yes, I can imagine I misinterpreted the instructions, but I don't think I did. Others code warriors here think the last test is incorrect.

  • Default User Avatar

    I agree that the last test case is faultly. If you look at the raw data and follow the requirements, 'c' is the winner instead of 'e'.