Back to course home
0% completed
Vote For New Content
I need help in understanding "Find all Missing Numbers (easy)" problem. Unlike t...
Azimul Haque
Mar 11, 2022
I need help in understanding "Find all Missing Numbers (easy)" problem. Unlike the previous problem, in which j = nums[i] was used, what is the reason for using j = nums[i] - 1 instead of j = nums[i] ? Please explain the reason why it is used as it has not been explained in the solution. Thanks!
2
0
Comments
Comments
Design Gurus4 years ago
In the previous problem the input array contains numbers from 0 to n, in this problem the number range is 1 to n. Since array index starts with 0, we subtract one to care for the input range of 1 to n.
A
Azimul Haque4 years ago
Thank you! This is clear now!!
On this page