Solving The Algorithm Question In Flight Entertainment

Usually I’ll use Leetcode to practice problem solving, but I came across this Interview Cake problem that really caught my attention. Note that this problem will be solved in JavaScript!

Solution
Outputs that belong to the console.logs from lines 24–26

Resources: