FastPrepCircular Memory Slot Allocator
Problems/Circular Memory Slot Allocator

Circular Memory Slot Allocator

ZipRecruiter logoZipRecruiter● MediumFULLTIMENEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Three ZipRecruiter OA reports describe circular slots, Save and Clear requests, a cyclic first-fit search from a requested index, failure without changes, Clear ranges that are guaranteed occupied, and a result for each request. We supplied zero-based indexing, ranges that wrap around, string rows, and validity limits. Our version is about 91% the same as the reported questions.

Memory contains totalSlots slots in a circle. Each request is [kind,start,length].

  • Save scans candidate starts cyclically beginning at start and finds the first run of length consecutive free slots, allowing the run to wrap. Occupy it and return its starting slot, or return -1 without mutation.
  • Clear frees the guaranteed-occupied circular run beginning at start and returns length.

Return one result per request.

Function

processMemoryRequests(totalSlots: int, requests: String[][]) → int[]

Examples

Example 1

totalSlots = 5requests = [["Save","1","2"],["Save","1","2"],["Clear","1","2"],["Save","1","2"]]return = [1,3,2,1]

Allocation, first-fit movement, clearing, and reuse are exercised.

Example 2

totalSlots = 5requests = [["Save","4","2"]]return = [4]

A run may wrap from the final slot to zero.

Constraints

  • 1 <= totalSlots <= 1000
  • 1 <= requests.length <= 100000
  • Every length is between 1 and totalSlots.

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Bank Accounts with Balance HistoryMeta · OAMeta interview questions
  • Capping Portfolio WeightsCapstone Investment Advisors · OA
  • Repeated Mirror XORMathWorks · OAMathWorks interview questions
  • Stacked Item and Category DiscountsPalantir · OAPalantir interview questions
  • Stabilize Student Test ScoresVirtu Financial · OAVirtu Financial interview questions
  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Minimize Task Resource ConsumptionNVIDIA · OANVIDIA interview questions
  • Index of the Maximum After Left RotationsChubb · OAChubb interview questions
  • Leaves Remaining After WindCresta · OACresta interview questions
  • Rolling MetricsAkuna Capital · OAAkuna Capital interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int[] processMemoryRequests(int totalSlots, String[][] requests) {
        // Write your code here.
    }

}
Checking account…