Ad
  • Custom User Avatar

    Passed testcases, failed on all randoms in python

  • Custom User Avatar

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

  • Custom User Avatar

    I feel you bro :D Although i do have to admit i can't wrap my head around the whole "slap a lambda in a line and then function gangbang the sh.t out of it" :D
    At least i now remember i can reverse a list with [::1] pretty handy. Still can't break down the whole zip unpack * thing. Gotta go step through it real quick :) Good job. Thanks for the inspiration. You made me grow again ;)

  • Custom User Avatar

    that is basically what i wanted to do but cleaner :D you could still reduce it by replacing res = res + with res +=
    otherwise very clean

  • Custom User Avatar

    well done although using counter is still slightly slower than pure regex + comprehensions. I must admit you did better on the regex than me :D just realized after using lower i didn't need the uppercase check... also much better handling of the ' cases. Thank you for the inspiration :)

  • Custom User Avatar

    Actually math is just a tool to improve performance in programming. I agree that 90% of the time you will just use the work of the people before you who did the math, but as programmers we are problem solvers per definition. If you keep programming and challenging yourself there will come a day where there is no precut algorithm and nothing you can cobble together from the existing knowledge is efficient enough. On that day you too will contribute by doing math and creating what is needed so those learning programming after you will have even less reasons to understand math to program. Programming is math - but in a cool way :D

  • Custom User Avatar

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

  • Default User Avatar

    No, it only returns True if cnt == 0, which means you have to close all opening ones.

  • Custom User Avatar

    Wouldn't this fail if the string has a closing parentheses before an opening one?

  • Custom User Avatar

    In my opinion this is the better solution compared to the #1 right now. Same length, similar readability but much more intuitively comprehensible.