You are given an integer array
nums
. We consider an array good if it is a permutation of an arraybase[n]
.
base[n] = [1, 2, ..., n - 1, n, n]
(in other words, it is an array of lengthn + 1
which contains1
ton - 1
exactly once, plus two occurrences ofn
). For example,base[1] = [1, 1]
andbase[3] = [1, 2, 3, 3]
.Return
true
if the given array is good, otherwise returnfalse
.Note: A permutation of integers represents an arrangement of these numbers.
1 | class Solution { |