Amazon Interview Question for Software Engineer / Developers






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

i can give you the algorithm how to perform.we find out the angle of minutes hand and hour hand reference point which is 12 o'clock in clockwise direction. now we find the difference between angle of both hand. if angle is smaller than 180 its is small sector else its is larger sector. and now we can see second hand. check if it lies between hour hand and minutes hand. it is in small sector. now how to find angles of hour and minutes hand.
for minutes hand. with every increase of 1 minutes 6 degree increase in angle from reference point. so angle = 6 * mm. now for hand .. we have to find exact position of hour hand.now we can find exact position of hour hand with the help of minutes hand. degree of hours hand = (hh+mm/12)* 6.

- Anonymous November 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

i can give you the algorithm how to perform.we find out the angle of minutes hand and hour hand reference point which is 12 o'clock in clockwise direction. now we find the difference between angle of both hand. if angle is smaller than 180 its is small sector else its is larger sector. and now we can see second hand. check if it lies between hour hand and minutes hand. it is in small sector. now how to find angles of hour and minutes hand.
for minutes hand. with every increase of 1 minutes 6 degree increase in angle from reference point. so angle = 6 * mm. now for hand .. we have to find exact position of hour hand.now we can find exact position of hour hand with the help of minutes hand. degree of hours hand = (hh+mm/12)* 6.

- sushantmax88 November 02, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1. Identify the angles of all the hands (hour, minutes and seconds) w.r.t. reference i.e 12:00. Name the angles as h, m and s
2. Let x = |h-s| ; y = |m-s|
3. If (|x+y| == |h-m|)
a. If ( |h-m| < 180deg)
print (Smaller Section)
b. else
printf (Larger Section)
4. else
a. If ( |h-m| > 180deg) //note its greater than here
print (Smaller Section)
b. else
printf (Larger Section)

- Piyush November 11, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

{
1. Identify the angles of all the hands (hour, minutes and seconds) w.r.t. reference i.e 12:00. Name the angles as h, m and s
2. Let x = |h-s| ; y = |m-s|
3. If (|x+y| == |h-m|)
a. If ( |h-m| < 180deg)
print (Smaller Section)
b. else
print (Larger Section)
4. else
a. If ( |h-m| > 180deg) //note its greater than here
print (Smaller Section)
b. else
print (Larger Section
}

-Reformatted

- Anonymous November 11, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Convert Hour hand position to minutes. Assuming that all seconds/minutes are marked as 1 to 60

1::20::22 can be translated as Hour hand at --> 1 X 5 = 5 and Minute hand at 20.

Since Second hand '22' is not between 5 and 22. It is in the other segment.

Based on this you can also easily point out whether seconds hand is in the major segment or minor segment.

- testers1234554 November 12, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Float S=ss/60;
Float M=mm*60+ss/3600
Float H=hh*3600+mm*60+ss/86400;
If (abs(H-M)==0.5)
Return special case;
If(H>M)
{
If((H-M)>0.5)
{
If(S>H||S<M)
Return small;
If(S<H&&S>M)
Return large;
}
Else
{
If(S>H||S<M)
Return large;
If(S<H&&S>M)
Return small;

}
}
Else
{
If((M-H)>0.5)
{
If(S>M||S<H)
Return small;
If(S<M&&S>H)
Return large;
}
Else
{
If(S>M||S<H)
Return large;
If(S<M&&S>H)
Return small;

}

}

- Anonymous December 09, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include "stdafx.h"
#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
float hh=1, mm=30,ss=22;

float HrPoint = (5*hh) + (mm/12) + (ss/720);
float MinPoint = mm + ss/60;

if((MinPoint - HrPoint) < 30)
{
if(ss > HrPoint && ss < MinPoint)
cout << "SMALL";
else
cout << "BIG";
}
else
{
if(ss > HrPoint && ss < MinPoint)
cout << "BIG";
else
cout << "SMALL";
}

cout << endl;

return 0;
}

- Anonymous January 12, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if the time is represented as hh:mm:ss in 12 hour format

then degree of the hour hand at this point is given by

hh*(360/12) + mm*(360/(60*12)) + ss*(360(/60*60*12))
	A		B		C

The factor A represents the degree by which hour hand moves every hour
the factor B represents the degree by which hour hand moves every minute
the factor C represents the degree by which hour hand moves every second

Similarly the degree of the minute hand is represented as follows

mm*(360/(60)) + ss*(360(/60*60))
	A		B

The factor A represents the degree by which minute hand moves every minute
the factor B represents the degree by which minute hand moves every second

The degree of the second has is given by ss*(360/60)

If the degree of the second hand falls with the range of the degree of the hour and the minute hand then it is in the inside sector else in the outside one

eg: for 5:01:15

degree of hour hand = 150.625
degree of minute hand = 7.5
degree of second hand = 90

As 90 lies between 150.625 and 7.5, the second hand lies in the inside sector

- ketz January 30, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

This is a simple question... if hhmod12<=ss<=mm, the second hand is between hour hand and minute hand in a clockwise direction. Also, if the above condition holds and mm<=30, the second hand is in the smaller section

- Anonymous February 05, 2011 | 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