217.Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.
O(N2) time O(1) memory, TLE, cited from Leetcode Discussion Board
1 | public boolean containsDuplicate(int[] nums) { |
O(N log N) time O(1) memory, TLE, cited from Leetcode Discussion Board
1 | public boolean containsDuplicate(int[] nums) { |
O(N) time O(N) memory
1 | public class Solution { |