Interview Experience At MoEngage
Summary
I recently interviewed at MoEngage, which included an in-depth discussion on Kafka internals and a challenging machine coding round focused on designing a Stock Price Volatility Monitor using a sliding window.
Full Experience
I recently had an interview at MoEngage. The initial phase delved into a comprehensive discussion about Kafka, covering essential topics such as producers, consumers, consumer groups, offset management, partitions, message ordering, backpressure handling, and ensuring Kafka's exactly-once semantics. We also explored Kafka internals in detail, including log compaction, retry mechanisms, and idempotency. Following this in-depth technical discussion, I proceeded to a machine coding round.
Interview Questions (1)
You are given a continuous stream of stock price changes (both positive and negative).
Your task is to design a VolatilityMonitor class that keeps track of the maximum volatility within the last N trades.
👉 Volatility = absolute value of price change
You must implement two methods:
recordTrade(int priceChange)- Adds a new trade.
- Only the last N trades are stored — so this forms a sliding window.
getMaxVolatility() → int- Returns the maximum absolute price change in the current sliding window.
📘 Example
Let tradeWindow = 3
Operation Window Max Volatility recordTrade(5) [5] 5 recordTrade(-3) [5, -3] 5 recordTrade(8) [5, -3, 8] 8 recordTrade(2) [-3, 8, 2] 8
The window always slides to keep only the last N price changes.