Find the Duplicate Number | Java | LeetCode - Medium - 287 | The Code Mate

preview_player
Показать описание
LeetCode June Challenge Problem : Day 25

Outline :
0:22 Introduction to the Problem
1:00 Detailed Explanation of Solution
19:20 Writing a final Solution

Note : Problem rights reserved by LeetCode.

#leetcode #programming #coding #techinterviews #googleinterview #facebookinterview #amazoninterview
Рекомендации по теме
Комментарии
Автор

But the problem says without modifying the array.

DeepakYadav-llmr
Автор

This is not the expected approach, putting a negative sign is modifying the array!

yashverma
Автор

We need to solve the problem without modifying the array as you said earlier:) in the videos while sorting

varunsaraf
Автор

The input array should not be modified. HOWEVER, since the elements in the input array are all positive, may be we can take the absolute value of the numbers to get the original input. But this would indeed make it a cheap solution/workaround.

solomoon
Автор

Brilliant solution. But I think you forgot to restore the array back to its original value by looping thru it once again and calling std:abs on each element.

prashantshanbhag
Автор

the mathematical approach will fail as the repeated number occurance can be 2 or more than two, ( you thought it can be repeated only once ) anyways i would suggest first try to submit your codes and then make a video

shanayagupta
welcome to shbcf.ru