Interview Solution

Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter. Eric S. Raymond

Reverse String

Language Java | Level Intermediate | Category Interview Problems | July 24, 2015 4:52 pm


Interview Problem

Reverse the given string without using the build in functions.
Write program to reverse the string without using any inbuilt functions
Given string "hello" return "olleh"


Given string 'Hello' and reverse string:olleH _



Posted by secret2006is
March 23, 2016 9:52 am

public static String reverse(String s) { StringBuilder sb = new StringBuilder(); for (int i = s.length() - 1; i >= 0; i--) sb.append(s.charAt(i)); return sb.toString(); }

Please login to add comments.