Help regarding c++ Mode program. | Sololearn: Learn to code for FREE!


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 from line 28 to 49 Here question link:

11/6/2019 11:51:13 AM

Aditya Kumar

5 Answers

New Answer


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😛



Aditya Kumar When i and j values are same, then arr[i] == arr[j] print i and j values when arr[i] == arr[j] What you are trying to do there, i didn't tried to understand.


~swim~ Well i was checking the elements are unique or not, if not increase the value of arrTemp[i] by One


Please looks at code again and post unencrypted comment