Facebook Interview Report
- 3of 3 votes
Answers/*
- dingdong April 16, 2015 in United States
For each node in a binary tree find the next right node on the same depth. Write a function that takes root node and populates "next" with the answer for each node.
A
/ \
B -> C
/ / \
D -> F-> G
/ \
H -> I
class Node {
Node left;
Node right;
Node next; // <-- answer should be stored here
};
B.next = C
D.next = F
F.next = G
H.next = I
{A, C, G, I}.next = null
*/| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm - -1of 1 vote
Answers/**
- dingdong April 16, 2015 in United States
* Find if the given list of recurring weekly intervals covers the
* entire time. Times are given up to a second.
*
* You can take the input intervals in the number of seconds since
* the beginning the week or any other format you prefer.
*
* ---Example 1---
* Input:
* Tuesday 9AM - Sunday 9AM
* Sunday 8:00:20AM - Wednesday 3AM
*
* Output:
* true
*
* ---Example 2---
* Input:
* Tuesday 9AM - Sunday 9AM
* Sunday 8:00:20PM - Tuesday 8AM
*
* Output:
* false
*/| Report Duplicate | Flag | PURGE
Facebook Software Engineer Algorithm