Interview Experience At MoEngage

moengage logo
moengage
December 5, 202591 reads

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)

Q1
Stock Price Volatility Monitor
Data Structures & AlgorithmsMedium

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:

  1. recordTrade(int priceChange)
    • Adds a new trade.
    • Only the last N trades are stored — so this forms a sliding window.
  2. 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.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!