(Help needed) Give those children some marks!

Problem
My Solution
I don’t know why it is giving TLE.

@arnie8991

Use const reference of the sg vector in the range function.

@arkadeep142
How will it affect my code?

In range function, pass sg by reference. Else it would create duplicate of sg array everytime you call it, making it O(n).

1 Like

Solved it using array.

Thanks for explanation

nice