Process a Mutable Stock-Price Log

Last updated: July 8, 2026

Quick Overview

The question asks you to design and implement a solution that processes a mutable log of stock prices, allowing for updates and queries on the stock price history.

Lead Bank
Coding & Algorithms
Software Engineer
Lead Bank
July 8, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

2

0

29 solved


The question asks you to design and implement a solution that processes a mutable log of stock prices, allowing for updates and queries on the stock price history.

This question is typically asked during the onsite coding round to evaluate a candidate's problem-solving skills and understanding of data structures. The interviewer is interested in how you approach the problem, your coding style, and your ability to optimize for both time and space complexity. Additionally, they want to see how you handle mutable data and ensure that your solution is efficient and scalable.

What the Interviewer Expects
  • Clearly explain your thought process and approach to the problem.
  • Choose appropriate data structures to manage stock prices efficiently.
  • Implement the solution with clean, maintainable code.
  • Discuss the time and space complexity of your solution.
  • Handle edge cases and potential errors in your implementation.
Key Topics to Cover
Data Structures
Mutable Data
Time Complexity
Space Complexity
Algorithm Design
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you modify your solution to handle a larger dataset?
  • What challenges did you face while implementing your solution?
  • Can you explain how your solution would perform under concurrent updates?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Approach

To process a mutable stock-price log, I would first define the requirements clearly. The system should allow for both updates to stock prices and queries for historical prices. I would consider using ...

Algorithm
  1. Data Structure Selection: Use a list to maintain the order of stock prices and a dictionary for quick lookups.
  2. Update Operation: When a new price is logged, append it to the list and upd...

Submit Your Answer
Markdown supported