C LeetCode Problem and Solution — Check if an array contains duplicate elements

Avi Parshan
3 min readJun 20, 2022

C LeetCode problem and solution — Check if an array contains duplicate elements

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. I provide two possible solutions in C, one is brute force and O(N²) while the second one is O(nlogn).

--

--