Explore Library
Code QuizAdvanced

Bidirectional Search Meeting Point

Spot why this meeting-point check can never detect a frontier intersection.

Codejavascript
function frontiersMeet(frontierForward, frontierBackward) {
  for (const node of frontierForward) {
    if (frontierForward.has(node)) {
      return true;
    }
  }
  return false;
}

This function should detect when the two searches meet, but it always returns true. What is the bug?