id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

containsDuplicate


Given an int[], return true if any value appears more than once, false if all values are unique. Use a HashSet add each value and check if it was already present. Stop as soon as you find the first duplicate.


containsDuplicate([1, 2, 3, 1]) → true
containsDuplicate([1, 2, 3, 4]) → false
containsDuplicate([1, 1]) → true

...Save, Compile, Run (ctrl-enter)

public boolean containsDuplicate(int[] arr) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Copyright Nick Parlante 2017 - privacy