Beautiful Triplet
CodeChefOpen on judge ↗
You are given two 1 based index arrays **A** and **B** of length n, both of which are **permutations** of [1, 2, 3, ..., N].\ A beautiful triplet is a set of 3 distinct values which are present in increasing order by position in both **A** and **B**. In simple words if we say i(x) is the index of the integer x in **A** and j(x) as the index of the value x in **B**, then a beautiful triplet will be
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.
Sign in to chat with the tutor and save your progress.
Sign in to start