Engineering With Java

Engineering With Java

Java Interview Question: Remove Inactive Users Efficiently

Efficient User Cleanup in Large Datasets

Suraj Mishra's avatar
Suraj Mishra
Feb 25, 2025
∙ Paid

Problem Description

Imagine you’re working on a user access control system for an application, and you need to clean up a list of users who have been marked as inactive. Your goal is to remove all inactive users (status = INACTIVE) from the list while keeping the operation efficient and minimizing memory usage.

The current solution creates a new list to store active users, which is memory inefficient for large lists.

  • How would you modify the solution to improve memory usage by operating in place?

  • What is the time complexity of your proposed solution, and how does it compare to the existing approach?


Consider becoming a free or paid subscriber and support the work :)

Still not convinced? Check out the details of the past work


This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Suraj Mishra · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture