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.
what you are doing is creating a reference variable and passing it every element ,so the reference to every variable(st[k]) is same.Instead what you have to do is initialise each variable independently so that each of them have has their own reference of a StringBuffer variable and changing one might not affect other.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Full Counting Sort
You are viewing a single comment's thread. Return to all comments →
what you are doing is creating a reference variable and passing it every element ,so the reference to every variable(st[k]) is same.Instead what you have to do is initialise each variable independently so that each of them have has their own reference of a StringBuffer variable and changing one might not affect other.