Comments

Bro, u have to visit all schools. according to ur technique, u are visiting 1 to n, 2 to n-2.....so on, but one thing u are forgetting that "You have to go from n to 2 then 2 to n-1, then n-1 to 3 then 3 to n-2.....so on." for input 10 output is 4 like this, 1 to 10, cost = 0 10 to 2, cost = 1 2 to 9, cost = 0 9 to 3, cost = 1 3 to 8, cost = 0 8 to 4, cost = 1 4 to 7, cost = 0 7 to 5, cost = 1 5 to 6, cost = 0 That s all, total ans = sum of all this = 4 I think I have cleared your doubt:)

On coderdhanraj → A Combinatorics Task, 4 years ago
0

similar problem is here sprinklr

Auto comment: topic has been updated by krishna.soni (previous revision, new revision, compare).