- Array Permutation
- 2024-05-07 19:45:10 @
Prerequisite: Implementation
Editorial: We already know that a permutation of N is 1 to N number that exactly once appears in the set.
For example, if N = 4, then permutation = {1, 2, 3, 4}.
Since the given numbers are 1 to N in the array, check for any duplicate numbers available in the array.
If there are any duplicate numbers available in the array, that means the array is not a permutation of N.
Time Complexity : O(N)
Code (C++) : Available in the Solutions Section.
0 comments
No comments so far...
Information
- ID
- 1055
- Difficulty
- 2
- Category
- Beginners Click to Show
- Tags
- (None)
- # Submissions
- 99
- Accepted
- 58
- Accepted Ratio
- 59%
- Uploaded By