Java Interview Question: Remove Inactive Users Efficiently
Efficient User Cleanup in Large Datasets
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



