0
Given an array containing n distinct integers in the range [0,n](inclusive of both 0 and n). Find and return number not in range
When nothing is missing why give zero?? Zero is already present there.Why int missingnumber =-1 not work?? Explain. https://sololearn.com/compiler-playground/cM5CzFa3Cy4t/?ref=app
2 ответов
+ 4
Your array contains 9 elements there, but you passed 8 as the 2nd argument on the call to to `missing()` function.
The for...loop inside the `missing()` function excludes <n> due to the wrong number of elements (2nd argument) passed. The task requires inclusion of both bounds of the range ( 0 ~ <n> ).
+ 2
DO NOT paste text in the title section, it gets cut off, nobody can read it.