NVIDIA Interview Question for Software Engineer / Developers

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

The hour hand of a normal 12-hour analogue clock turns 360° in 12 hours (720 minutes) or 0.5° per minute. The minute hand rotates through 360° in 60 minutes or 6° per minute. So,the angle between Hr hand and Minutes hand is |0.5*(60*h + m) - 6*m|. For example angle between hr hand and minutes hand at 3hr 30 minutes is |0.5*(60*3 + 30) - 6*30| = |0.5*210 - 90| = 75 degree.

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

Hi, Can u explain how 6*30 in there is 90??

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

So basically this works all the time!

``float degree= 0.5*(60*h + m) - 6*m;``

Can you tell us how did you think of this formula impromptu? Some logic that you must have thought of?

Do enlighten us!

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

hour angle = 360 * (hour % 12)/12;
Minute Angle = 6* minutes.

So for 3 .30 hour angle = 360* (3%12)/12 = 90 degrees
minute angle = 6*30 = 180 degrees

So angle = 180 -90 = 90 degrees

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

wrong ans, at 3:30 hrs the hour hand is beyond 3 and it cannot form right angle(90 deg) with minutes hand...it's some what less that 90

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

this is the wrong answer. please do watch the clock at 3:30 pm and assess whether the angle is 90 degree or not

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

hour hand for 1 hour=30 degree
minute hand for 1 hour =360 degree

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

Minute angle = M*6 (each minute 6 degrees)
Hour angle = H*30 + 30 * (60/M) - each hour 30 degrees + part of 30 degrees depends
on how many minutes.

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

abs(30*(h+m/60) - 60*m)

Time in H:M (5:30, 12:20, etc.)

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

In the text book, why has the author taken the remainder with 360 i.e. (%360) of the final expression ?
(30h - 5.5m) % 360

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

abs(h*(360/12)+(m/60)*(360/12) - m*6)

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.

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.