New Grad Software Engineer Interview Questions

2,906 new grad software engineer interview questions shared by candidates

Given a binary tree root and function which prints the value of the node at the (x,y) position in the screen, write a function to print the entire tree in the screen. A lot of edge cases to take care here... 1. The resolution of the screen (its dimensions). 2. Cannot collapse two values at the screen. 3. How do you take care of large numbers on the same vertical line? 4. This was the follow-up question. Maybe it was because I first started with using the same distance for all the children at the same level. The question was to optimize the distance used. For example to use only distance 1 if I didn't need more. Some examples to understand what I talking about. 1 d=1 / \ d = 1 2 3 1 / \ d = 2 / \ 2 5 / \ / \ d = 1 3 4 6 7 You can not use d=1 at the first level because 4 and 6 will collide.
avatar

Software Engineer New Grad

Interviewed at Microsoft

4
Jul 2, 2019

Given a binary tree root and function which prints the value of the node at the (x,y) position in the screen, write a function to print the entire tree in the screen. A lot of edge cases to take care here... 1. The resolution of the screen (its dimensions). 2. Cannot collapse two values at the screen. 3. How do you take care of large numbers on the same vertical line? 4. This was the follow-up question. Maybe it was because I first started with using the same distance for all the children at the same level. The question was to optimize the distance used. For example to use only distance 1 if I didn't need more. Some examples to understand what I talking about. 1 d=1 / \ d = 1 2 3 1 / \ d = 2 / \ 2 5 / \ / \ d = 1 3 4 6 7 You can not use d=1 at the first level because 4 and 6 will collide.

Viewing 1461 - 1470 interview questions

Glassdoor has 2,906 interview questions and reports from New grad software engineer interviews. Prepare for your interview. Get hired. Love your job.