Centered Block Placement Queries
Updated
Problem statement
Process queries on an infinite integer number line while maintaining obstacle coordinates.
[1, x]places an obstacle at coordinatex. That coordinate is guaranteed to be empty.[2, x, size]checks a centered block whose occupied integer coordinates run fromx - size + 1throughx + size - 1, inclusive. Append'1'when the entire range is obstacle-free and'0'otherwise. A check does not place a block.
Return the results of all checks as one binary string.
Function
processBlockQueries(queries: int[][]) → StringExamples
Example 1
queries = [[2,0,3],[1,2],[2,0,3],[2,-3,2]]return = "101"The first check covers -2 through 2 and is clear. After inserting at 2, the same range is blocked. The final check covers -4 through -2 and remains clear.
Example 2
queries = [[1,5],[2,5,1],[2,4,1],[2,3,3]]return = "010"A size-one check covers only its center. The last range covers 1 through 5 and includes the obstacle.
Constraints
1 <= queries.length <= 100000.- Insertion queries have two integers and check queries have three integers.
-10^9 <= x <= 10^9and1 <= size <= 10^9.- Inserted obstacle coordinates are distinct.
More Roblox Online Assessment questions
- Robot Navigation Around LasersOA · Seen Oct 2026
- Factory Batch Profit (Game Adaptation)OA · Seen Sep 2026
- Nested Recipe Blocks (Game Adaptation)OA · Seen Sep 2026
- Vehicle Builds for Required Terrain (Game Adaptation)OA · Seen Sep 2026
- Track Received Byte RangesOA · Seen Sep 2026
- Break a PalindromeOA · Seen Jun 2026
- Count Pairs Differing in One DigitOA · Seen Oct 2025
- Find Zero Cells in a 2×2 GridOA · Seen Oct 2025
- Cat Route Budget Planning (Game Adaptation)OA · Seen Aug 2025
- Minimum Height Difference Between Distant PeaksOA · Seen Aug 2025
Similar questions at other companies
- Rolling MetricsAkuna Capital · OAAkuna Capital interview questions
- Maximum Profit from an Increasing Price TripletOdoo · OAOdoo interview questions
- Longest Subarray with Sum at Most KGoogle · OAGoogle interview questions
- Maximum Laptop Rating in a Price RangePostman · OAPostman interview questions
- Employee Ratings Management SystemAmazon · PHONE SCREEN
- Running Medians and PercentilesStackAdapt · PHONE SCREENStackAdapt interview questions
- Range ModuleWalmart · PHONE SCREENWalmart interview questions
- Order Sequence Prefix Counts and QuantitiesHeadlands Technologies · PHONE SCREENHeadlands Technologies interview questions
- Count Later Lower ReadingsRippling · ONSITE INTERVIEWRippling interview questions
- Bank Accounts with Balance HistoryMeta · OAMeta interview questions
Interview reports that mention this question
Roblox interview experiences
- Roblox New Grad Early OA Tasks: 10 Experiences (Part 7 of 7)
- Roblox New Grad Engineer Rounds: 13 Experiences (Part 6 of 7)
- Roblox New Grad HackerRank OA: 18 Experiences (Part 5 of 7)
- Roblox New Grad CodeSignal Finals: 23 Experiences (Part 4 of 7)
- Roblox New Grad Games and BQ: 25 Experiences (Part 3 of 7)