my solution is not giving correct output on hacker but giving correct output on my pc. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

my solution is not giving correct output on hacker but giving correct output on my pc.

link of the question... i know my code is a mess https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem https://code.sololearn.com/c49i4K5x7Q4y/? ref=app

26th Apr 2018, 4:25 PM
aditya
aditya - avatar
4 Answers
+ 3
Have you compiled with all warnings set? I often compile as follows: g++ -Wall fred.cpp Which gives warnings.
27th Apr 2018, 6:35 PM
Emma
+ 2
Also, did you copy their code, and just enter your code where it says? They will have some kind of validation code that requires the code is a certain structure. They'll probably run a test dataset through the function climbingLeaderboard(), and check the vector object that is returned.
27th Apr 2018, 6:37 PM
Emma
+ 1
I've just completed this problem. You need to take all the code from Hacker Rank, and just add to the function where it says "Add code here". You're better off using vectors for this, in my opinion. If you add Alice's score to a copy of the score list, then remove duplicates, then reverse sort it, you just need to then find the index of her score, and add one to it. Then repeat for all her scores.
27th Apr 2018, 5:13 AM
Emma
0
Xan i did lots of questions with my own code...but this is doing something wierd ..you can even run this code in sololearn, running completely okay
27th Apr 2018, 5:35 PM
aditya
aditya - avatar