← All problemsSign in

A Teacher teachings

**In Hidden Leaf Village**, there are lots of great Shinobi who have mastered the art of *Ninjutsu and Genjutsu.* Now they want the new *Genins* in the village to learn these too. You are given an array of size **N** denoting the position of ***i $^t$$^h$*** Ninja as **A$_i$**. Any Ninja in the village can communicate to any other Ninja who is sitting from him at most at a distance of **K**

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