Reported September 2026
Ripplingsliding window

Consistent Logs

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

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

Rippling's Consistent Logs showed up in September 2026 reports, and it looks friendlier than it is. You compute the smallest global frequency, call it m, then find the longest subarray where no user appears more than m times. Sliding window, but the setup trips people up. Read the definition twice: the max frequency in the window must equal m exactly, not just stay under it. If you blank on the details, StealthCoder sits invisibly on your screen during the live OA and hands you a working solution as a safety net.

The problem

You are given an integer array userEvent, where userEvent[i] is the ID of the user who triggered event i.
Let minimumGlobalFrequency be the smallest total frequency of any user ID in the entire array. A contiguous subarray is consistent when the frequency of its most frequent user is exactly minimumGlobalFrequency.
Return the maximum length of a consistent subarray.

Function
findConsistentLogs(userEvent: int[]) → int

Examples
Example 1
userEvent = [1,2,1,3,4,2,4,3,3,4]
return = 8
In the entire array, users 1 and 2 each appear 2 times, while users 3 and 4 each appear 3 times. Therefore, minimumGlobalFrequency = 2.
The subarray [1,2,1,3,4,2,4,3] has length 8, and every user in it appears exactly 2 times. Its maximum frequency is therefore 2, so it is consistent. Every subarray of length at least 9 contains a user with frequency 3, so 8 is the maximum length.
Example 2
userEvent = [7,7,8,8]
return = 4
Both users appear 2 times in the entire array, so minimumGlobalFrequency = 2. The full array is consistent and has length 4.

Constraints
1 <= userEvent.length <= 3 * 10^5
1 <= userEvent[i] <= 10^9

Reported by candidates. Source: FastPrep

Pattern and pitfall

Count global frequencies with a hash map and take the minimum, m. Now run a sliding window with a second frequency map. Expand right, add the element, and while its count exceeds m, shrink from the left. Track the longest window. Here's the edge case that breaks naive code: the window needs max frequency of exactly m, not at most m. But it always works out. The user with global frequency m appears m times in total, and any window containing all of them hits exactly m. The longest valid window under the cap, if it contains that user fully, is consistent. If the longest capped window misses that user's events, you can extend it until it includes them, and the cap still holds for the reason of the optimal answer. Pitfall: sorting or recomputing max frequency per window, which goes quadratic at 3 * 10^5 elements. Keep it O(n) with two pointers and a hash map. StealthCoder is your hedge if the exact-versus-at-most logic slips under the clock.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Consistent Logs 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 by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Rippling reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Consistent Logs FAQ

What's the trick in Consistent Logs?+

Find the minimum global frequency m first. Then it's a sliding window that keeps every user's count in the window at or below m. Shrink from the left whenever the newly added user's count goes over m. The longest window seen is your answer.

How hard is this Rippling OA question really?+

Medium. The window code is standard. The hard part is parsing the definition and convincing yourself that capping at m is enough. Once you see the cap logic, it's about fifteen lines with a hash map.

What complexity do I need given the constraints?+

The array can reach 3 * 10^5 elements, so you need O(n) or O(n log n). Two pointers with a hash map is O(n). Recomputing the max frequency for every subarray is quadratic and will time out.

Which edge cases should I test?+

Test a single element, where m is 1 and the answer is 1. Test all-distinct arrays, where the answer is the full length. Test the sample [7,7,8,8], which returns 4. Also test values up to 10^9, so use a hash map and not an array index.

How do I prepare for this in 48 hours?+

Practice two or three variable-size sliding window problems that use a frequency map and a cap. Write the shrink loop from memory. Then run the two examples by hand, since the 8 in Example 1 verifies your window logic.

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

OA at Rippling?
Invisible during screen share
Get it