40
2
Given a nonempty finite list of integers, output a truthy value if there are exactly two equal entries and all other entries are distinct, and a falsey value otherwise.
Examples
truthy:
[1,1]
[1,2,1]
[1,6,3,4,4,7,9]
falsey:
[0]
[1,1,1]
[1,1,1,2]
[1,1,2,2]
[2,1,2,1,2]
[1,2,3,4,5]
I suppose we can't assume that the integers will always be less than 10? – Martin Ender – 2017-10-11T20:17:57.713
1Yes except if your language does not support any larger integers. – flawr – 2017-10-11T20:22:19.027
1Can you elaborate what you mean by consistent? – flawr – 2017-10-11T20:40:59.103
Are the truthy and falsey values returned required to be the same regardless of the input, or could different falsey or truthy values be returned? – Emigna – 2017-10-11T21:01:55.440
No they need to be truthy and falsey as defined. – flawr – 2017-10-11T21:02:01.937
33Saw this on the top of HNQ & thought we’d reached the final interpersonal.se question – gntskn – 2017-10-11T23:15:48.570
@gntskn Saw this on the top of SE's homepage and thought the same. – Tamás Sengel – 2017-10-12T08:10:12.200
Allowing more than one soul mates couple would have add a bit of challenge, everyone is just posting code about removing duplicates and check that the length drop to the original length - 1. – Walfrat – 2017-10-12T10:44:51.513
3@Walfrat Post it as your own challenge. Also such feedback is usually appreciated in the sandbox. – flawr – 2017-10-12T14:37:56.747
Are all values non-negative? – FlipTack – 2017-11-12T08:05:11.797
Yes you can assume that. – flawr – 2017-11-12T09:23:14.833