Ad
  • Custom User Avatar

    'join' is a method on an array object. You are not returning an array, so no .join method exists.

  • Custom User Avatar

    many random tests failing saying one fewer rider is needed than is actually needed by problem domain.

  • Custom User Avatar

    I'll never understand why beginners try to shoehorn cs101 everywhere. Changing data types doesn't affect Big-O complexity. And trying to speed up things based on general rules without benchmarking just leads to complex and slow code.
    Yes, memory allocations take time, but when you are using python, everything takes time. It's a very slow language. Keeping the no. of interpreted steps to a minimum will often outspeed lower memory allocations.
    Here's a fun exercise. Try benchmarking my solution and yours.

  • Default User Avatar

    ok, so, as usual, this is context dependent...

  • Custom User Avatar

    From a cs perspective, every time you change a data type new memory is allocated and time complexity is increased (Big-O). Python does memory management under the hood, so it is easy to ignore. In a lot of ways the brilliance of the Python interpreter is that is this black box that you throw code into and it does some magic and spit out what you asked for. This is a big topic, though, more than a comment forum. If you are working with small data in a low use environment, memory managment isn't a big deal. If you are paying the AWS bill, best practices become real important.

  • Default User Avatar

    I'm curious to know why it would be so..........

  • Custom User Avatar

    clever, yes, but best practice would not include changing data type (int -> str).