Leetcode #217. Contains Duplicate — Solution

Today we are going to solve Leetcode 217. Contains Duplicate.

Photo by James Harrison on Unsplash

Problem Statement

Given an array of integers, find if the array contains any duplicates.

Input: [1,2,3,1]
Output: true
Input: [1,2,3,4]
Output: false
Input: [1,1,1,3,3,4,3,2,4,2]
Output: true

Solution

This problem can be approached in many ways.

Tech-enthusiastic . Connect me — https://twitter.com/sourav__saikia

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store