Strictly increasing
Strictly increasing easy asked in interviews by 1 company Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Strictly increasing easy asked in interviews by 1 company Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement:
Given an integer array a of size N. Find out if by rearranging the elements, you can make the array strictly increasing. In other words, determine if it is possible to rearrange the elements such that a1 < a2 < ⋯ < a n holds.
You must solve this problem in O(N) time complexity. Input First line contains n. Next line contains n space separated integers.
Constraints 1 <= n <= 105 1 <= a[i] <= 105 Output Print "YES" or "NO". Example Input: 5 2 1 90 2 4
Output: NO
link: