Amazon Interview Question for Software Engineer in Tests






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

expression= z * (x + (x+1) + (x+2).......+y)

= z * (x + (x+1) + (x+2).......+ (x + (y-x)) )

= z * ( (x + x + x......(y-x+1 times)) + (1 + 2 + 3 .....+ (y-x)) )

= z * ( x * (y-x+1) + ((y-x)*(y-x+1)/2))

= z * (y-x+1) * (x + (y-x)/2)

= z/2 * (y-x+1) * (x + y )


Much easier to plug in the values and test the code from here

- (Chris) Gayle (VVS) Laakmann December 07, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

nice one!!! good math work./..
but i think when test it.. u have to include boundary conditions like, 0,0,0
or -1, -2, 10

some cases where it would fail.. but really enjoyed this simplification thanks!

- clrs March 25, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thanks for the simplification!!

- Richa Aggarwal February 03, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Verify giving 0 to all variables
Verify by giving negative value to all / any one variables
With Large number in all / any one variable
Passing other datatypes instead of integer
Passing null for any one variable

- Raaga November 08, 2013 | 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