217. Contains Duplicate

Practice Contains Duplicate for free on NudgeCode: Easy, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Given an integer array nums, return true if any value appears at least twice, and false if every element is distinct.

Example

nums = [1,2,3,1]  ->  true
nums = [1,2,3,4]  ->  false

Constraints