2010-11-13, 02:16 AM
So I just realized that I could unwrap my function to save a few chars.
Without extra credit, 77.
Edit: Based on my own benchmarking, this algorithm appears to run in quadratic time with respect to len(s), which is definitely sub-optimal.
Here's a linear-time version that does not use str.lstrip() and is probably not as short as it could be:
Python: 94
Without extra credit, 77.
Edit: Based on my own benchmarking, this algorithm appears to run in quadratic time with respect to len(s), which is definitely sub-optimal.
Here's a linear-time version that does not use str.lstrip() and is probably not as short as it could be:
Python: 112

