Timeline for PermMissingElem- find the missing element in a given permutation in C#
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 10, 2021 at 18:54 | history | protected | CommunityBot | ||
Dec 1, 2018 at 17:05 | answer | added | Dankks | timeline score: 3 | |
Oct 25, 2017 at 12:54 | answer | added | Rick Davin | timeline score: 0 | |
Apr 13, 2017 at 12:40 | history | edited | CommunityBot |
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
|
|
May 26, 2016 at 23:56 | history | tweeted | twitter.com/StackCodeReview/status/735982907559432192 | ||
May 26, 2016 at 7:20 | vote | accept | Tolani | ||
May 26, 2016 at 2:19 | answer | added | Risky Martin | timeline score: 0 | |
May 25, 2016 at 18:46 | comment | added | Brian | Use an array of bools and set each index to true as you find that index in the permutation. Whichever leftover element is false is the missing element. This is O(N) space instead of the required O(1) space. The trick is to use a virtual array of bools by flipping the sign bit on the input array elements (if the array elements were signed, we could mark elements as true by adding array.length to corresponding index instead). | |
May 25, 2016 at 15:28 | comment | added | Eric Lippert | This question becomes much more interesting if the elements are not integers, but rather are distinct objects that can be compared for equality, and that's all. If you know they are integers and one is missing, you just sum the integers with one missing, sum the integers with none missing, and the difference of the two sums is obviously the missing integer. | |
May 25, 2016 at 12:22 | answer | added | gfv | timeline score: 27 | |
May 25, 2016 at 12:00 | vote | accept | Tolani | ||
May 26, 2016 at 7:20 | |||||
May 25, 2016 at 11:34 | answer | added | JanDotNet | timeline score: 11 | |
May 25, 2016 at 11:02 | answer | added | AlanT | timeline score: 2 | |
May 25, 2016 at 9:44 | history | edited | Vogel612 | CC BY-SA 3.0 |
added 56 characters in body
|
May 25, 2016 at 9:27 | history | asked | Tolani | CC BY-SA 3.0 |