BlackRock Interview Question: Reverse a string in java.... | Glassdoor

Interview Question

Summer Analyst Interview(Student Candidate)

Reverse a string in java.


Interview Answer

1 Answer


Neeraj Kulkarni of Bloomberg Law Ke Ma Ke Chooth

class ReverseString {
  public static String reverseIt(String source) {
    int i, len = source.length();
    StringBuffer dest = new StringBuffer(len);

    for (i = (len - 1); i >= 0; i--)
    return dest.toString();

Neeraj Kulkarni Ke Ma Ke Chooth on Jun 8, 2011

Add Answers or Comments

To comment on this, Sign In or Sign Up.