
g0201_0300.s0287_find_the_duplicate_number.Solution.ex Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of leetcode-in-all Show documentation
Show all versions of leetcode-in-all Show documentation
104 LeetCode algorithm problem solutions
# #Medium #Top_100_Liked_Questions #Array #Binary_Search #Two_Pointers #Bit_Manipulation
# #Binary_Search_II_Day_5 #Big_O_Time_O(n)_Space_O(n)
# #2024_08_04_Time_1322_ms_(100.00%)_Space_165_MB_(100.00%)
defmodule Solution do
@spec find_duplicate(nums :: [integer]) :: integer
def find_duplicate(nums) do
(nums -- Enum.uniq(nums)) |> hd
end
end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy