leetle

Daily challenge for 2025-11-12

316. Find the Duplicate Number

Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive, there is exactly one repeated number. Return this repeated number.

You must solve this without modifying the array and uses only constant extra space.

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

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

Run this challenge interactively in Python or JavaScript when the app loads.