logo CodeStepByStep logo

binaryBoarding2

Related Links:

Write a function named binaryBoarding2 (similar to the previous exercise, binaryBoarding) that finds the missing seat ID from a list of airplane seat specifications. The input data and its meaning is exactly as in the previous exercise. Your goal is to find and return the ID of the one and only "missing" seat from the data set that is not in the very first or last row. The missing seat is defined as one that is a valid seat ID on the plane, where that seat ID is not seen in the data set, but the seat id -1 and +1 away from it ARE seen in the data set.

For example, if row 3, seat 4 is the missing seat, return 3 * 8 + 4 = 28.

Function: Write a JavaScript function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.