Some error occured while loading page for you. Please try again.
Sort 81 Discussions, By:
Please Login in order to post a comment
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.
thanks for the link. very helpful @subashm6
Not sure this challenge really helps with grasping the concept of loop invariant. Many people can just fetch the solution of the previously solved Insertion Sort challenge.
This seemed like more of a "find the bug" challenge to me...
There is no code on the page for me :p so there was no bug. I was really confused so I just implemented insertion sort in the compiler and got full credit? who knows...
Java code produces an extra main() at the bottom outside of the class declaration. As such, it produces an error at compile. Not a big deal and certainly easy to fix, just putting it out there.
Reported it to Hackerrank staff. Their reply (verbatim): "It looks like this challenge was posted a few years ago, and has been solved by many users. Would you mind checking the discussion area to see if other users have run into this issue and received a resolution?"
This was on August 23rd 2015
No more replies after my follow-up
So yeah... please everyone reading this use the 'Suggest edits' option on the Problem tab to let the Hackerrank team know that just because people can deal with a silly error in the template code it doesn't mean it is not there.
To people still reading this as of July 13th 2016, it seems like this has been resolved.
in while loop just make it j>=0
Just started working on these. Can Swift be added when you get a chance?
sort() works in python,and to my surprise that code too was accepted as a solution .
Yep, that one is very easy to cheat :)
Best nickname ever =]
What's the point of cheating?
What's the point of anything?
I can recommend help if you feel like you need it?
what's the point of that?lol
what's the point of lol?
You may think of it as easy 30 points (just make j>=0) but the whole purpose of this question is to introduce us to the concept of loop invariants which are used to formally reason about the correctness of code.
I didn't get the idea of the question i just change one thing(j>0 to j>= 0) and it works...
My submission's status is still processing after more than 15 minutes. What is the problem?