Challenges • Asked 10 days ago by grvchik
I do not understand the explanation of this problem
nums[nums[i] - 1] != nums[i]) can give ArrayIndexOutOfBounds Exception as we are assuming that nums[i] will be an index
Besides this, explanation states we are comparing the current number with previous number
It should be nums[i-1]!=nums[i]
I'm sorry that you're having difficulty with this problem.
nums[i] > 0clause ensures we don't get an
I've gone ahead and recorded an explainer video for it here and updated the tutorial to make it more understandable. Hope it clarifies your issues.