We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Each student's arrival time is given as either negative (on time or early) or positive (late). The professor sets a threshold (k) for the minimum number of on-time arrivals needed to avoid canceling class. If the number of on-time arrivals is less than k, the class is canceled; otherwise, it continues. You need to count how many students arrive on time and compare that count with k to determine if the class is canceled or not for each test case. If the count of on-time arrivals is less than k, return "YES" (class canceled); otherwise, return "NO" (class not canceled). This type of calculation can be done through any kind of software on desktop or PC.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Angry Professor
You are viewing a single comment's thread. Return to all comments →
Each student's arrival time is given as either negative (on time or early) or positive (late). The professor sets a threshold (k) for the minimum number of on-time arrivals needed to avoid canceling class. If the number of on-time arrivals is less than k, the class is canceled; otherwise, it continues. You need to count how many students arrive on time and compare that count with k to determine if the class is canceled or not for each test case. If the count of on-time arrivals is less than k, return "YES" (class canceled); otherwise, return "NO" (class not canceled). This type of calculation can be done through any kind of software on desktop or PC.