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.
why should we run the loop till length of the string and why not length-1
because when te value of i reaches l-1 that is itself the last element of the string so will the substring(i+1)not give any garbage value?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Super Reduced String
You are viewing a single comment's thread. Return to all comments →
why should we run the loop till length of the string and why not length-1 because when te value of i reaches l-1 that is itself the last element of the string so will the substring(i+1)not give any garbage value?