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).

--

Android Developer behind unitMeasure. https://tech.aviparshan.com

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