Reported September 2026
Agodaarray

Longest All-Present Attendance Streak

Reported by candidates from Agoda's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Agoda OA. Under 2s to a working solution.
Founder's read

The mistake that sinks a first attempt on this Agoda OA, reported in September 2026, is overthinking it. The hinted pattern says dynamic programming, but the problem is a single pass. Each day either has every employee present or it doesn't. Then you track the longest run of qualifying days. If you start building a 2D table across employees, you've already wasted ten minutes. It's an easy-tier problem wearing a scary disguise. And if you blank anyway, StealthCoder runs invisibly on your screen during the live OA and hands you the clean version.

The problem

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[]) → int

Examples
Example 1
attendance = ["YYY","YYY","YNY","YYY"]
return = 2
The first two days form the longest all-present streak.
Example 2
attendance = ["NN","YN","NY"]
return = 0
Every day has at least one absence.
Example 3
attendance = ["Y","Y","Y"]
return = 3
All 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'.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Here's the trick. Collapse each day's string into one boolean: does it contain any 'N'? If not, the day qualifies. Then walk the array with a running counter. Qualifying day, increment. Non-qualifying day, reset to 0. Keep a max the whole way. That's O(n * m) time and O(1) space, and with n up to 10^5 and m up to 100, that's fine. The common pitfall is treating columns as the unit, since each position is an employee, and trying to compute streaks per employee then intersecting them. That's more code and more bugs. Another slip is forgetting to update the max before the reset, or returning the final counter instead of the max. Check example 2 to confirm you return 0. If you freeze during the live OA, StealthCoder is the hedge that surfaces this loop for you.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Longest All-Present Attendance Streak cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Agoda's OA.

Agoda reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Longest All-Present Attendance Streak FAQ

How hard is the Agoda Longest All-Present Attendance Streak problem really?+

Easy. It's a single loop with a counter and a max. The string-per-day format looks like a grid problem, but you only need to check whether each string contains an 'N'. Most candidates finish it in a few minutes if they don't overcomplicate it.

What's the trick to solving it?+

Reduce each day to a yes or no. A day qualifies only if it has no 'N'. Then it's the classic longest consecutive run: increment a counter on qualifying days, reset on bad days, and track the max as you go.

Is this really dynamic programming?+

Only loosely. The running counter is a tiny one-state DP, where today's streak depends on yesterday's. You don't need a table or memoization. Think of it as a linear scan with a streak variable and you'll be fine.

What edge cases should I test before submitting?+

Test all days bad, which must return 0. Test all days good, which returns the array length. Test a single day, and a streak at the very end of the array so your max update isn't skipped. Also check a one-character-per-day input.

How do I prepare for this in 48 hours?+

Write the longest consecutive run pattern from scratch a few times until it's automatic. Practice checking a string for a character with a built-in or a loop. Then rehearse reading the problem for the simplest reduction before you reach for heavy structures.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Agoda.

OA at Agoda?
Invisible during screen share
Get it