You are viewing a single comment's thread. Return to all comments →
Hackerrank can help us by introducing to concepts, it is not their duty to monitor like a teacher. Those who cheat are cheating themselves!
This loop invariant concept is being asked in some interviews.
When the complexity of the problem increases, it is not easy to check the correctness of algorithm/program with trivial inputs through trial and error.
Loop invariant is directly related to mathematical proofs of correctness.
To know more about Loop Invariant, you can check the following link.
Introduction to Loop Invariants I found elaborate explanation here.
Atleast know the purpose of Loop invariants.