DataDriven
LearnPracticeInterviewDiscussDailyJobs

The Loudest Voice

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
L4

Problem

An event stream pushes one event-type string per record, and during an incident a single type can swamp the feed. Given a list of event type strings `events`, return the type that appears strictly more than half the time (more than `len(events) // 2` occurrences), or `None` when no type clears that bar. The feed can hold up to 500000 records and you cannot afford to keep a separate count for every distinct type, so solve it in O(1) extra space.

Summary

One event type is drowning out the rest. Find it.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons