Company: OYO_SDE intern_Oncampus_24june

Difficulty: medium

Problem Statement

A shopping mall has an automated escalator system where people move between floors using escalators. Each floor is connected to the next floor via an escalator, allowing people to travel up or down based on the system's settings. Due to a malfunction, some escalators may cause people to enter an infinite loop instead of reaching the exit. The goal is to detect if the escalator system contains a loop, meaning a person keeps moving in a cycle instead of reaching the exit. Function Description You must implement the function escalator_loop . Parameters int N  The number of floors in the escalator system. int[] next_floor  An array of size N , where: next_floor[i] represents the next floor a person moves to from floor i . If next_floor[i] = -1 , it means the person exits the system from that floor. Input Format The first line contains an integer N ( 1  N  10^5 ), the number of floors in the system. The next line contains N space-separated integers, where the i th integer represents the

More OYO_SDE intern_Oncampus_24june OA questionsInterview experiences