Timeline for Python 3 two-sum performance
Current License: CC BY-SA 4.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 29, 2020 at 8:09 | comment | added | 301_Moved_Permanently | Walrus operator makes this so nice! | |
| Aug 28, 2020 at 6:11 | comment | added | mathandy |
This won't work in all cases, e.g. if the first number is half the target, it'll return [0,0]. A quick fix is return next(((index, i2) for index, value in enumerate(numbers) if value in bounds and (i2 := bounds[value]) != index), None)
|
|
| Aug 12, 2018 at 7:42 | history | edited | 301_Moved_Permanently | CC BY-SA 4.0 |
added 19 characters in body
|
| Aug 11, 2018 at 18:44 | history | answered | 301_Moved_Permanently | CC BY-SA 4.0 |