FastPrepForward Block Placement Queries
Problems/Forward Block Placement Queries

Forward Block Placement Queries

Capital One logoCapital One● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The source gives the obstacle placements, the forward interval checks, a result as a bit string, and one concrete example. We chose what happens with a duplicate placement, the coordinate limits, that lengths are positive, and that a check does not change anything.

Process operations on a nonnegative integer line. Initially, no position contains an obstacle.

  • [1, x] places an obstacle at position x. Placing an obstacle at an occupied position has no additional effect.
  • [2, start, length] asks whether every integer position in the inclusive interval [start, start + length - 1] is empty. Append 1 when the block fits and 0 otherwise. A query does not place a block.

Return the appended bits as one string in query order.

Function

forwardBlockPlacementQueries(operations: int[][]) → String

Examples

Example 1

operations = [[1,2],[1,5],[2,3,2],[2,3,3],[2,1,1],[2,1,2]]return = "1010"

Positions 3 through 4 are empty, but 3 through 5 contains an obstacle. Position 1 is empty, while 1 through 2 contains an obstacle.

Example 2

operations = [[2,0,1],[1,0],[2,0,1],[1,0],[2,1,3]]return = "101"

The first query succeeds. After position 0 is occupied, the second fails; repeating the build is idempotent, and positions 1 through 3 remain empty.

Constraints

  • 1 <= operations.length <= 10^5.
  • Each operation is either [1, x] or [2, start, length].
  • 0 <= x, start <= 10^9.
  • 1 <= length <= 10^9.
  • Interval endpoints fit in signed 64-bit integers.

More Capital One Online Assessment questions

  • Rank Football TeamsOA · Seen Oct 2026
  • Count Subarrays Matching a Comparison PatternOA · Seen Oct 2026
  • Arithmetic Triplets After QueriesOA · Seen Oct 2026
  • Branch with the Most FilesOA · Seen Oct 2026
  • Count One-Swap Number PairsOA · Seen Oct 2026
  • Distinct Values on Maximum-Sum FramesOA · Seen Oct 2026
  • Earliest Meeting Time for All EmployeesOA · Seen Oct 2026
  • Earn the Most 🐝OA · Seen Oct 2026
  • Sort Adjacent PairsOA · Seen Oct 2026
  • Bouncing Diagonal WeightsOA · Seen Oct 2026

Similar questions at other companies

  • Index of the Maximum After Left RotationsChubb · OAChubb interview questions
  • Rolling MetricsAkuna Capital · OAAkuna Capital interview questions
  • Souvenir Shop PurchasesAmazon · OA
  • The OraclesRubrik · OARubrik interview questions
  • Online Meeting Scheduler with Fixed RoomsUber · ONSITE INTERVIEWUber interview questions
  • Detect a Silent SensorConfluent · ONSITE INTERVIEWConfluent interview questions
  • Sorted Insertion SnapshotsSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Finish Ordered CPU Tasks with the Fewest CPUsGoogle · PHONE SCREENGoogle interview questions
  • Capping Portfolio WeightsCapstone Investment Advisors · OA
  • Subscription and Usage-Based Billing CalculatorStripe · OAStripe interview questions

Interview reports that mention this question

  • Capital One Experienced Engineer Power Day and OA: 6 Experiences

Capital One interview experiences

  • Capital One New Grad OA Questions: 14 Experiences (Part 2 of 2)
  • Capital One TDP Agentic Round (AI Coding): 7 Experiences
  • Capital One SWE Power Day, Level Not Reported: 6 Experiences
  • Capital One TIP Intern OA and Power Day: 13 Experiences
  • Capital One TDP Agentic Power Day: 25 Experiences (Part 1 of 2)
All Capital One interview questionsSee Capital One hiring insights
Saved
class Solution {
    public String forwardBlockPlacementQueries(int[][] operations) {
        // Write your code here.
    }
}
Checking account…