- 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
- 8
- Category
- Beginners Click to Show
- Tags
- (None)
- # Submissions
- 12
- Accepted
- 9
- Accepted Ratio
- 75%
- Uploaded By