Exercises/#89 Find the Duplicate Number
#89

Find the Duplicate Number

Medium⚡ Bit Manipulation
90 XP

Problem

Given an array of n+1 integers where each integer is in [1, n], find the duplicate number without modifying the array and using O(1) extra space.

Examples

Input: nums=[1,3,4,2,2]
Output: 2

Input: nums=[3,1,3,4,2]
Output: 3
bit-manipulationfloydarray
AI Assistant— powered by AI

Unlock hints progressively — start gentle, go deeper only if needed.

💡

Level 1: Gentle Nudge

A subtle direction

🗺️

Level 2: Approach

The algorithm to use

🔍

Level 3: Detailed

Step-by-step guidance

89 / 150

Your Solution

⚡ JavaScript

to save progress and use AI features