Interview Solution

Learning to program has no more to do with designing interactive software than learning to touch type has to do with writing poetry Ted Nelson

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.