Longest All-Present Attendance Streak
Updated
Problem statement
You are given daily attendance records in attendance. Each string represents one day, each position represents the same employee across all days, 'Y' means present, and 'N' means absent.
Return the maximum number of consecutive days on which every employee was present. A day qualifies only when every character in its record is 'Y'. Return 0 when no day qualifies.
Function
longestAllPresentStreak(attendance: String[]) → intExamples
Example 1
attendance = ["YYY","YYY","YNY","YYY"]return = 2The first two days form the longest all-present streak.
Example 2
attendance = ["NN","YN","NY"]return = 0Every day has at least one absence.
Example 3
attendance = ["Y","Y","Y"]return = 3All three days qualify.
Constraints
1 <= attendance.length <= 10^5.1 <= attendance[i].length <= 100.- All strings have the same length and contain only
'Y'and'N'.
Source note: Author-written prompt excerpt retained for source fidelity.
More Oracle Phone Screen questions
- Remove Parentheses from a Plus-Minus ExpressionPHONE SCREEN · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · Seen Oct 2026
- Shortest Window by Distinct-Value SumPHONE SCREEN · Seen Oct 2026
- Detect a Cycle in a Directed GraphPHONE SCREEN · Seen Oct 2026
- Time-Based Key-Value StorePHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Remove Adjacent Duplicates in String IIPHONE SCREEN · Seen Oct 2026
- Sum Root-to-Leaf Binary NumbersPHONE SCREEN · Seen Oct 2026
- Next PermutationPHONE SCREEN · Seen Sep 2026
- Valid ParenthesesPHONE SCREEN · Seen Sep 2026
- Valid Parenthesis StringPHONE SCREEN · Seen Sep 2026
Similar questions at other companies
- Search and Format ContactsAdyen · PHONE SCREENAdyen interview questions
- Detect a Straight FlushTemu · PHONE SCREENTemu interview questions
- Longest Common PrefixKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
- Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
- Single-Condition Product FilterCrowdstrike · PHONE SCREENCrowdstrike interview questions
- Match a Variadic Function SignatureConfluent · PHONE SCREENConfluent interview questions
- Parse and Sort Integer DataLegora · PHONE SCREEN
- Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
- Most Frequent NameAmazon · PHONE SCREEN
- Process Refunds with Bounded RetriesMercor · PHONE SCREENMercor interview questions