← All problemsSign in

Triplet Groups

A permutation of length $N$ is an array consisting of $N$ distinct integers from 1 to N in random order. Let us take array $A$ = [1,5,3,4,2] is a permutation, but [1,2,3,3] is not a permutation because 3 appears twice in the array and [1,3,4] is also not a permutation because $N$=3 but there is 4 in the array. Your friend is really fond of playing with numbers but this time he gives you a task

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start