Anuj Shops
CodeChefOpen on judge ↗
There are $N$ Shops on a road. You are given their positions in form of an array $A$, where $Ai$ denotes the position of $ith$ shop. Initially, Anuj is standing at position $K$ and he wishes to visit all the shops but he's too tired. Help Anuj Finding the minimum distance he'll have to travel in order to visit every shop. ###Input: First Line denotes the number of test cases. First line of each
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