Amazon Interview Question: In Person with 4 people (~45m... | Glassdoor

Interview Question

Software Development Engineer III Interview San Francisco, CA

In Person with 4 people (~45min each): 1. Check if binary

  tree A is contained in binary tree B. Write code on paper. 2. Derive a formula for calculating the angle between the hour hand and minute hand in a clock. 3. Design a parking lot. Discuss what data structures to use.
Answer

Interview Answer

1 Answer

0

public static double clockAngle(int hours, int minutes)
    {
        double minuteAngle = minutes * 6;
        double hourAngle = hours * 30 + minutes / 2.0;
        double result = hourAngle - minuteAngle;
        if (result < 0)
        {
            result += 360;
        }
        return result;
    }

Ozan Eren Bilgen on Oct 19, 2012

Add Answers or Comments

To comment on this, Sign In or Sign Up.