Longest All-Present Attendance Streak
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'.