C LeetCode Problem and Solution — Check if an array contains duplicate elements
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).