← All problemsSign in

Intersections

Problem Description: In this particular problem you are given any permutation p of {1,. . . . . . . , n}. Now you create a function which maps 1 to 1 in p, 2 to 2 in p and so on. Now if you draw lines to map the numbers some of the lines will intersect. For example consider p = {1, 2, 5, 3, 4}, now mapping will look like this Now in the image above line c intersects with line e and line d inte

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