Skip to main content
saved 2 bytes
Source Link
RGS
  • 14.1k
  • 1
  • 57
  • 116

Python 3, 2927 bytes

lambda s:[*{*range(9)0,1,2,3}-s][:2]

Try it online!Try it online! The input is a set s with the integers. We build the set {0, 1, 2, 3, 4, 5, 6, 7, 8} and then perform set subtraction to remove, from that set, any input numbers. We then convert to a list and extract two elements.

Thanks Surculose for saving me 2!

Python 3, 29 bytes

lambda s:[*{*range(9)}-s][:2]

Try it online! The input is a set s with the integers. We build the set {0, 1, 2, 3, 4, 5, 6, 7, 8} and then perform set subtraction to remove, from that set, any input numbers. We then convert to a list and extract two elements.

Python 3, 27 bytes

lambda s:[*{0,1,2,3}-s][:2]

Try it online! The input is a set s with the integers. We build the set {0, 1, 2, 3, 4, 5, 6, 7, 8} and then perform set subtraction to remove, from that set, any input numbers. We then convert to a list and extract two elements.

Thanks Surculose for saving me 2!

Source Link
RGS
  • 14.1k
  • 1
  • 57
  • 116

Python 3, 29 bytes

lambda s:[*{*range(9)}-s][:2]

Try it online! The input is a set s with the integers. We build the set {0, 1, 2, 3, 4, 5, 6, 7, 8} and then perform set subtraction to remove, from that set, any input numbers. We then convert to a list and extract two elements.