We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
ok I found out the first for loop gives us the count of the respective elements in another array
Example:
ar[0] = 2;
ar[1] = 4;
ar[2] = 3;
ar[3] = 2;
ar[4] = 3;
ar[5] = 1;
ar[6] = 2;
ar[7] = 1;
ar[8] = 3;
ar[9] = 3;
ary[0] = 1;
ary[1] = 1;
ary[2] = 1;
ary[3] = 2;
ary[4] = 2;
ary[5] = 1;
ary[6] = 3;
ary[7] = 2;
ary[8] = 3;
ary[9] = 4;
but my doubt now is how did you come up with this logic about the first for loop??????
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Migratory Birds
You are viewing a single comment's thread. Return to all comments →
ok I found out the first for loop gives us the count of the respective elements in another array Example: ar[0] = 2; ar[1] = 4; ar[2] = 3; ar[3] = 2; ar[4] = 3; ar[5] = 1; ar[6] = 2; ar[7] = 1; ar[8] = 3; ar[9] = 3;