Code RoomLongest character streak
EasyPrep Room Coding #575

Longest character streak

CodingAlgorithms & data structuresEntry–Mid~11 min

A chat quality tool flags key-smash by finding the character behind the longest streak. Given a non-empty message, return the character of the longest run of consecutive identical characters, as a one-character string. If several runs tie for longest, return the one that appears first. For example, 'heyyy nooo' returns 'y' (its run of 3 starts before the 'o' run of 3).

Implement
longest_run_char(message: str) → str
Examples
in["heyyy nooo"]out"y"
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 11 min
InputExpectedGot
["heyyy nooo"]"y"not run yetsample