Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
When comparing against my solution, this one cost more gas to deploy, but once deployed it cost less gas to use. This is a better solution imo.
Bit shifting allows for more efficient gas usage for this instance since its doing a multiple of 2. Had to find a more efficient way since I was being called a pleb :p
I tried to think of way to get mines in 1 line. Nice!
Nice use of a generator.
Could've used numpy for better performance. Decided to just stick with built in functionality
the decision to save len(s) was merely so I didn't calculate it more than once. I chose to sacrifice space in order to save time. Albeit the amount of time I'm calculating is small.
Since python strings are immutable do you need to do l+=s. If im understanding you correctly your goal was to not manipulate the input string due to good practice; however, since strings are immutable that will never happen. Also, could you explain why you would need the second for loop to remove 1 character? I definitely understand your logic in your code and why you programmed this way; however, I am curious about the remove statements .
I like how you used recursion. I wanted to only add _ at the last character as well but my mind took me to a different solution.
LMAO!!!
Explanation:
Used a dictionary for O(1) access
text.lower() to lower all text in string O(n) time
alpha[x] for x in text if x in alpha
Overall performace should be O(k*N) where k is a constant
If i'm wrong on Overall performance then please correct me
Good use of xrange. Didnt know that it was more efficient than range in python2. For those reading this during python3
Checkout the below for an explanation.
Link: https://www.geeksforgeeks.org/range-vs-xrange-in-python/
Realized I could've made this more efficent by returning after an element in the array has been inserted.