You will be given a string. It will contain 9 unique integers from 0-9. You must return the missing integer. The string will look like this:
123456789
> 0
134567890
> 2
867953120
> 4
Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It only takes a minute to sign up.
Sign up to join this communityYou will be given a string. It will contain 9 unique integers from 0-9. You must return the missing integer. The string will look like this:
123456789
> 0
134567890
> 2
867953120
> 4
|s:&str|s.bytes().fold(477,|s,b|s-b as i32)
This is the same strategy as in Level River St's Ruby answer.