We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
You can forego list() call on the first line since you immediately proceed to multiple assignment without using any list-specific methods.
I also used range() in my solution since it's a generator in Python 3, which saves memory as opposed to slicing a[i+1:] which copies the references (8 bytes each) of the sliced portion of list. But in Python community this might be called premature optimization :)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →
You can forego list() call on the first line since you immediately proceed to multiple assignment without using any list-specific methods.
I also used range() in my solution since it's a generator in Python 3, which saves memory as opposed to slicing a[i+1:] which copies the references (8 bytes each) of the sliced portion of list. But in Python community this might be called premature optimization :)