While I agree that the time differences seem insignificant, there are plenty of fields where that delta can become an issue... or would at least be considered (e.g. neural nets, machine learning, etc.). What do you mean by inappropriate? What would be the correct way to have done it? Thank you for any help/guidance you can provide.
both have the same time complexity. Nobody will care about that difference (except maybe traders...). Morevover, considering the timings you got, there are chances that the way you tested both isn't appropriate.
This comment is hidden because it contains spoiler information about the solution
thats super good answer
Would you please mind your language a little bit more. Thank you.
I have the same problem. I like python, but sometimes I think my thought process lends itself to a more C or java type language.
minor point, but enumerate accepts a starting number as an argument. In other words, you get enumerate to count from 1 rather than using n + 1
At that point wouldn't you just use numpy arrays?
check out for time complexity. it's going O(N^2)
True, I should have done that