Forest Interview Questions

4,242 forest interview questions shared by candidates

You are in a room with 3 switches which correspond to 3 bulbs in another room and you don't know which switch corresponds to which bulb. You can only enter the room with the bulbs once. You can NOT use any external equipment (power supplies, resistors, etc.). How do you find out which bulb corresponds to which switch?
Mar 18, 2009

You are in a room with 3 switches which correspond to 3 bulbs in another room and you don't know which switch corresponds to which bulb. You can only enter the room with the bulbs once. You can NOT use any external equipment (power supplies, resistors, etc.). How do you find out which bulb corresponds to which switch?

Assume that you are given the head and tail pointers of a doubly linked list where each node can also have a single child pointer to another similar doubly linked list. There are no cycles in this structure outside of the traditional double links. Write a procedure in C++ that flattens this structure into a single list.

Assume that you are given the head and tail pointers of a doubly linked list where each node can also have a single child pointer to another similar doubly linked list. There are no cycles in this structure outside of the traditional double links. Write a procedure in C++ that flattens this structure into a single list.

The first 12 digits of pi are 314159265358. We can make these digits into an expression evaluating to 27182 (first 5 digits of e) as follows: 3141 * 5 / 9 * 26 / 5 * 3 - 5 * 8 = 27182 or 3 + 1 - 415 * 92 + 65358 = 27182 Notice that the order of the input digits is not changed. Operators (+,-,/, or *) are simply inserted to create the expression. Write a function to take a list of numbers and a target, and return all the ways that those numbers can be formed into expressions evaluating to the target For example: f("314159265358", 27182) should print: 3 + 1 - 415 * 92 + 65358 = 27182 3 * 1 + 4 * 159 + 26535 + 8 = 27182 3 / 1 + 4 * 159 + 26535 + 8 = 27182 3 * 14 * 15 + 9 + 26535 + 8 = 27182 3141 * 5 / 9 * 26 / 5 * 3 - 5 * 8 = 27182
avatar

General Applications for Start-ups

Interviewed at Triplebyte

3.5
Oct 15, 2015

The first 12 digits of pi are 314159265358. We can make these digits into an expression evaluating to 27182 (first 5 digits of e) as follows: 3141 * 5 / 9 * 26 / 5 * 3 - 5 * 8 = 27182 or 3 + 1 - 415 * 92 + 65358 = 27182 Notice that the order of the input digits is not changed. Operators (+,-,/, or *) are simply inserted to create the expression. Write a function to take a list of numbers and a target, and return all the ways that those numbers can be formed into expressions evaluating to the target For example: f("314159265358", 27182) should print: 3 + 1 - 415 * 92 + 65358 = 27182 3 * 1 + 4 * 159 + 26535 + 8 = 27182 3 / 1 + 4 * 159 + 26535 + 8 = 27182 3 * 14 * 15 + 9 + 26535 + 8 = 27182 3141 * 5 / 9 * 26 / 5 * 3 - 5 * 8 = 27182

Viewing 1 - 10 interview questions

Glassdoor has 4,242 interview questions and reports from Forest interviews. Prepare for your interview. Get hired. Love your job.