Check if Array is Good Problem

Check if Array is Good Problem — ExecCode Easy DSA Practice

Solve the Check if Array is Good problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given an integer array nums. Your task is to compute the required answer and return true if the given array is good, otherwise return false. We consider an array goodif it is a permutation of an array base[n]. base[n] = 1, 2, ..., n - 1, n, n. For example, base[1] = [1, 1] andbase[3] = [1, 2, 3, 3]. Note:A permutation of integers represents an arrangement of these numbers.

Examples

Input {"nums": [2, 1, 3]}; Output False. Input {"nums": [1, 3, 3, 2]}; Output True

Constraints

1 <= nums.length <= 100 1 <= num[i] <= 200

Practice Check if Array is Good free on ExecCode. Browse DSA problems, topic map, and placement guides.