LeetCode Daily Question 15
Mar 22nd 2022
3 月 22 日 每日一题
题目:287. 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 only one repeated number in nums, return this repeated number.
You must solve the problem without modifying the array nums and uses only constant extra space.
1 | Example 1: |
思路
hashmap 应该算这道题的暴力解法,等肝完 281project 之后可能会在这里更新其他方法。
代码
1 | class Solution { |