3881. Direction Assignments with Exactly K Visible People
You are given three integers n, pos, and k. There are n people standing in a line indexed from 0 to n - 1. Each person independently chooses a direction: - 'L': visible only to people on their right - 'R': visible only to people on their left A person at index pos sees others as follows: - A person i < pos is visible if and only if they choose 'L'. - A person i > pos is visible if and only i
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