Amazon Interview Question for Software Engineer / Developers


Team: Hyderabad
Country: India
Interview Type: Phone Interview




Comment hidden because of low score. Click to expand.
0
of 0 vote

sed?

- Anonymous March 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Textpad has some options for doing it bulk.

At the end of the day it is through regular expression find and replace the pattern will be faster :-)

- howaboutthis March 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1- have read write pointers on the string to replace space
2- Fill the memory to minimize disk access
3- If block in the memory is not changed dont write it back, keep a clean dirty bit + location info for %5 and just write that part back instead of whole block

- appdev March 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Dude was this question asked for Freshers?

- VIneet Setia March 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

No, this question asked for 5+ exp in java

- Hussain March 14, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Shall we use String.replaceAll method for that?

- flyinocean March 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I started my answer with available java api, but the interviewer told not to use api as api always has its own overhead.

- Hussain March 14, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

the chance of you writing something that's more efficient than the JDK? very slim. the interviewer should have said "this is an interview question i want you to do it manually."

- jeff April 05, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

1. Regular Expression? Here's a Java Snippet

public class RegularExpression
{
	public static void regularExpression(String s)
	{
		Pattern p = Pattern.compile("%20");
		Matcher m = p.matcher(s);
		System.out.println(m.replaceAll(" "));
	}
}

- movingincircles March 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I would appreciate if you provide the complexity as well.

- Test March 15, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

You write this kind of code when you are at work, but in the interview you are not allowed to use these function

- Hieu March 15, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I believe they will not allow you to use built-in library, for example Replace, Regex. You have to write your own algorithm, you can use KMP to answer this question

- Hieu March 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes, You are right. They told me to use my own algorithm.

- Hussain April 05, 2012 | Flag


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