Skip to main content
added 122 characters in body
Source Link
FlipTack
  • 14.7k
  • 3
  • 54
  • 101

Pushy, 8 bytes

Simple implementation of checking whether len(set(list)) == len(list)-1:

LtvuL^=#

Explanation:

       \ Implicit: Put all input on stack
Ltv    \ Get the stack length - 1, save in auxiliary stack
u      \ Remove non-unique elements
L      \ Get the new length
^=     \ Compare with the previously saved length
#      \ Print result

This works as the length will only decrease by 1 if there was only exactly 1 non-distinct integer in the initial list.

Try it online!

Pushy, 8 bytes

Simple implementation of checking whether len(set(list)) == len(list)-1:

LtvuL^=#

Explanation:

       \ Implicit: Put all input on stack
Ltv    \ Get the stack length - 1, save in auxiliary stack
u      \ Remove non-unique elements
L      \ Get the new length
^=     \ Compare with the previously saved length
#      \ Print result

Try it online!

Pushy, 8 bytes

Simple implementation of checking whether len(set(list)) == len(list)-1:

LtvuL^=#

Explanation:

       \ Implicit: Put all input on stack
Ltv    \ Get the stack length - 1, save in auxiliary stack
u      \ Remove non-unique elements
L      \ Get the new length
^=     \ Compare with the previously saved length
#      \ Print result

This works as the length will only decrease by 1 if there was only exactly 1 non-distinct integer in the initial list.

Try it online!

Source Link
FlipTack
  • 14.7k
  • 3
  • 54
  • 101

Pushy, 8 bytes

Simple implementation of checking whether len(set(list)) == len(list)-1:

LtvuL^=#

Explanation:

       \ Implicit: Put all input on stack
Ltv    \ Get the stack length - 1, save in auxiliary stack
u      \ Remove non-unique elements
L      \ Get the new length
^=     \ Compare with the previously saved length
#      \ Print result

Try it online!