Timeline for The fastest way to find one unique value when all other values are the same
Current License: CC BY-SA 4.0
21 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 26, 2020 at 0:15 | history | edited | user33306 | CC BY-SA 4.0 | added optimized code. |
| Jul 26, 2020 at 0:06 | history | edited | user33306 | CC BY-SA 4.0 | deleted 492 characters in body |
| Jul 25, 2020 at 23:52 | history | edited | user33306 | CC BY-SA 4.0 | Added optimization |
| Jul 25, 2020 at 17:24 | comment | added | Kelly Bundy | Rather disappointing that the by far slowest solution gets the most upvotes and gets accepted. See benchmarks. | |
| Jul 25, 2020 at 15:19 | vote | accept | Jacques | ||
| Jul 25, 2020 at 13:54 | history | edited | user33306 | CC BY-SA 4.0 | tidied up the algorithm |
| S Jul 25, 2020 at 12:01 | history | suggested | aki | CC BY-SA 4.0 | Redundant else |
| Jul 25, 2020 at 11:57 | review | Suggested edits | |||
| S Jul 25, 2020 at 12:01 | |||||
| Jul 25, 2020 at 11:56 | comment | added | aki | @tinstaafl Oh you changed the conditions.. I meant the literal string else: can be removed & indent be fixed, and it will still work fine. It's one of C++ style preferences. clang.llvm.org/extra/clang-tidy/checks/… | |
| Jul 25, 2020 at 11:54 | comment | added | user33306 | Yes you're right. It's been fixed | |
| Jul 25, 2020 at 11:53 | history | edited | user33306 | CC BY-SA 4.0 | deleted 70 characters in body |
| Jul 25, 2020 at 11:48 | comment | added | aki | There are two redundant elses here. the code will work without them too. | |
| Jul 25, 2020 at 10:01 | comment | added | MT0 | @Turksarama That is an invalid input as "All numbers are equal except for one." The code works for [0,0,2]. | |
| Jul 25, 2020 at 9:47 | comment | added | Turksarama | This answer breaks for [0, 1, 0, 0, 1, 2]. You will always need to read the whole list, because the unique element could always be the last one. | |
| Jul 25, 2020 at 7:51 | history | edited | user33306 | CC BY-SA 4.0 | added 27 characters in body |
| Jul 25, 2020 at 7:16 | history | edited | user33306 | CC BY-SA 4.0 | added 53 characters in body |
| Jul 25, 2020 at 7:11 | comment | added | user33306 | The challenge guarantees at least 3 elements. How can you tell which is unique if there are only 2 | |
| Jul 25, 2020 at 7:09 | history | edited | user33306 | CC BY-SA 4.0 | deleted 5 characters in body |
| Jul 25, 2020 at 7:09 | comment | added | Roland Illig | If your code gets a 2-element array, it access arr[2], which is out of bounds. | |
| Jul 25, 2020 at 3:08 | history | edited | user33306 | CC BY-SA 4.0 | deleted 117 characters in body |
| Jul 25, 2020 at 2:59 | history | answered | user33306 | CC BY-SA 4.0 |