Komli Media Interview Question for Software Engineer / Developers


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
1
of 3 vote

void reverse (char *s , int i, int j)  {
       if(i<j){
                 swap(s[i],s[j]);
                reverse(s,i+1,j-1);
      }
}

- richa.shrma.iitd March 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

static std::string Reverse(std::string s)
{
	if (s.size() == 1) return s;
	
	return Reverse(s.substr(1)) + s[0];
}

- gimli March 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote
I think it is asking to use the divide and conquer technique. {{{ public string Reverse(string value) { if (value.Length == 1) return value; string leftMostChar = value.SubString(0,1); string remainChars = value.SubString(1); return Reverse(remainChars) + leftMostChar; } - Anonymous March 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I am making small assumption before writing this code . .

main()
{
          char c = getchar();
          if( c !='\n')
                main();
          putchar(c);
}

- Shivaprasad April 02, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class ReverseString {

	static String reverse = "";
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		String str = "abcd";
		System.out.println(str);
		str = reverseString(str, str.length());
		System.out.println(str);
	}

	private static String reverseString(String str, int len) {
		// TODO Auto-generated method stub
		
		if(str.length() == 1) return str;
		if(len == 0) return reverse;
		reverse = reverse + str.charAt(--len);
		return reverseString(str, len);
	}

}

- sunand March 14, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 3 vote

void reverse(char* str)
{
  int len=strlen(str);
  int i=0,j=len-1;
  char temp;
  while(j>i){
    temp=str[i];
    str[i]=str[j];
    str[j]=temp;
    i++;
    j--;
  }
}

- feiskyer March 25, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More