Many people use 'substring' method. I found many people simply use 'substring' method in String class. I was wondering substring of String class cause overhead. so i decompiled String.class. public String substring( int beginIndex) { if (beginIndex < 0 ) { throw new StringIndexOutOfBoundsException (beginIndex); } int subLen = value . length - beginIndex; if (subLen < 0 ) { throw new StringIndexOutOfBoundsException (subLen); } return (beginIndex == 0 ) ? this : new String (value, beginIndex, subLen); } You can see 'new String()' code at the end of the function. Every time new instance created when it called. The HackerRank Problem is below. https://www.hackerrank.com/challenges/reduced-string It is better to use 'StringBuffer' then 'String'. Below is deleteCharAt method of 'StringBuffer'. public AbstractStringBuilder deleteCharAt( int index) { if ...