Ad
  • Default User Avatar

    javascript - check my solution without the sort to get the error on the fourth test.

  • Default User Avatar

    I had to sort my returning array because the test was not happy with [2, 1] instead of [1, 2]

  • Custom User Avatar

    Is there a sample test case? My code failed the sample test case with unknown error but passed the actual tests. Really strange behaviour.

    import re
    def strip_url_params(url, params_to_strip = []):
        split = url.split('?')
        if len(split) == 1:
            return url
        param_string = split[1]
        parameters = [x.split('=') for x in param_string.split('&')]
        test = set(params_to_strip)
        trim_url = lambda param, val: re.sub(r'&%s=%s' % (param, val), '', url)
        for x in parameters:
            if x[0] in test:
                url = trim_url(x[0], x[1])
            test.add(x[0])
        return url
    
  • Default User Avatar

    I had a brainfart while doing this excercise and instead of doing division I did a while loop over k checking each one if it matches. It would be good if one of the test k's would be so big that such approach would not get pass a test :)