+ 2

Help regarding c++ Mode program.

Here my code:(its working BUT Why arr[i] is always equal to arr[j] even if all the elements are unique) arr is a sorted vector containing all the numbers and "a" is the number of elements in vector. for example arr[10]=64630 11735 14216 99233 14470 4978 73429 38120 51135 67060 https://code.sololearn.com/cXkB2o1jOZ2l/?ref=app from line 28 to 49 Here question link: https://www.hackerrank.com/challenges/s10-basic-statistics/problem

6th Nov 2019, 11:51 AM
Aditya Kumar
Aditya Kumar - avatar
4 Answers
+ 1
so changing value at line 30 [j=j+1] (initially j=1) and at line 36 [==0] (initially ==1), made it work as should be I am dumb sometime😛
6th Nov 2019, 1:56 PM
Aditya Kumar
Aditya Kumar - avatar
+ 1
Edited
6th Nov 2019, 12:48 PM
Aditya Kumar
Aditya Kumar - avatar
0
~swim~ Well i was checking the elements are unique or not, if not increase the value of arrTemp[i] by One
6th Nov 2019, 2:17 PM
Aditya Kumar
Aditya Kumar - avatar
0
Please looks at code again and post unencrypted comment
6th Nov 2019, 2:24 PM
Aditya Kumar
Aditya Kumar - avatar