Timeline for Find the unique twins
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2020 at 9:04 | history | edited | CommunityBot |
Commonmark migration
|
|
Nov 3, 2017 at 16:47 | history | edited | Piyin | CC BY-SA 3.0 |
edited body
|
Nov 3, 2017 at 16:45 | comment | added | Piyin | Yes, I understand that, I was just telling you why that wouldn't work hehe The function definition in ES5 doesn't support the arrow: medium.com/@manojsinghnegi/… I reduced it to 114, though, thanks to your clarification | |
Nov 3, 2017 at 16:31 | history | edited | Piyin | CC BY-SA 3.0 |
"b" has to be a string
|
Nov 3, 2017 at 16:26 | comment | added | Mr. Xcoder | As I said above, I don't know Javascript at all, so I don't know the appropriate versions. Anyway it would be 112 bytes with lambdas taking input via currying, but IDK if that would work in ES5 too. | |
Nov 3, 2017 at 16:25 | comment | added | Piyin | But that JavaScript you came up with would be ES5, not ES6. An ES6 answer is already posted, which is why I posted the ES5. And thanks for answering the second question hehe | |
Nov 3, 2017 at 16:24 | comment | added | Mr. Xcoder | Yeah sure a string input would be fine | |
Nov 3, 2017 at 16:24 | comment | added | Mr. Xcoder |
I did manage to get to 115 bytes although I don't know JavaScript: f=(a,b)=>{for(b=''+b,i=a.sort().length;--i+1;)if(a[i]!=a[i+1]&&a[i]!=a[i-1]&&!(b.split(a[i]).length-2))return a[i]} .
|
|
Nov 3, 2017 at 16:24 | comment | added | Piyin |
Thanks for clearing that out. I don't think lambda functions can save any characters, but I'll try. Also, since you say "Any reasonable Input and Output method / format is allowed", could I accept an string as b and save b=''+b, ?
|
|
Nov 3, 2017 at 16:18 | comment | added | Mr. Xcoder | Welcome to PPCG! You cannot remove the function definition, but you might be able to use a lambda function instead (I don't know JS so I cannot help you with that). | |
Nov 3, 2017 at 16:16 | history | edited | Piyin | CC BY-SA 3.0 |
Saved one byte by wrapping it all on a for
|
Nov 3, 2017 at 16:10 | review | First posts | |||
Nov 3, 2017 at 16:18 | |||||
Nov 3, 2017 at 16:05 | history | answered | Piyin | CC BY-SA 3.0 |