SarthakKeshari / CPP-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
47 stars 132 forks source link

Find Array Duplicates #314

Closed Ritwik009 closed 2 years ago

Ritwik009 commented 2 years ago

Issue Id you have worked upon -

310

Briefly explain your program logic -

In this, we basically mark the element as negative ones its visited,so if we encounter negative again means its already visited. It will take O(N) time and O(1) extra space.

Screenshots(Attach 2 screenshots of your own input and output) -

Screen Shot 2021-10-07 at 1 10 54 AM Screen Shot 2021-10-07 at 1 11 05 AM


Checklist:

Eg - If your code follow the below guidelines. Kindly change [] to [x]

All the conditions should be fulfilled for considering your code for merging -