Amazon Online Assessment 2021 (OA) - Good Segment

You've been nominated to participate in a programming challenge as part of your Day 1 Orientation at Amazon. Given an array of bad numbers and a range of integers, determine the longest segment of integers within the range that does not include any bad numbers.

This is a companion discussion topic for the original entry at