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.
hi! o(1) in best its obviously, if the element is the first ) I talk about worst of coz.
the algorithm i wrote takes O(n) at its worst and O(1) (constant time) at its best.
Hi! Not bad idea, but .remove() modify List - create (see source) new array as fact. Its dramatically decrease performance on huge array. GL!
time complexity O(n^2)... )))))) ooookey realy best practies
probably make a separate function to subtract the time from the till with the smallest checkout time, but i was too lazy to do that lol. mostly just doing these to revise my syntax
hi! I think used "timer" (time) its bad idea... what about time-for-one-customers like 10^6 ? For Example {130000, 140000, 150000, 160000, 120000 ...} :-/
hi ^_^ you used .sort() - customers+1 times. What about realy big supermarket with 10^8 of customres and 10^2 tills? ;))) This kata may solved w/o sort anyway
Oh, just another solve with .sort() Hi! What about 10^8 elements array?
hi! IMHO i make a realy fast solution with O(n/3)! 100000000 elements complite on 165 millis ))) May you see my work? One important note - i used Double.compare coz... we work with double values ))) If array contained integer values speed disastrously grow