FastPrepRectangle Fit Queries
Problems/Rectangle Fit Queries

Rectangle Fit Queries

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Two ZipRecruiter new-grad OA reports describe the save and query operation encodings, independent fit checks, 90-degree rotation, the rule that only earlier saves count, and a true result before any save. They leave out limits, a function signature, and image data, so our version supplies those details.

Process the rows of operations from left to right. Each row has one of two forms:

  • [0, a, b]: create and save a rectangle of size a × b.
  • [1, a, b]: determine whether every rectangle saved by earlier operations can fit inside a box of size a × b.

Test each saved rectangle separately; the rectangles do not need to fit in the box at the same time. You may rotate a rectangle by 90 degrees.

Return one boolean for each query operation, in query order.

Function

solution(operations: int[][]) → boolean[]

Examples

Example 1

operations = [[1,1,1]]return = [true]

No rectangles have been saved, so every saved rectangle vacuously fits and the answer is true.

Example 2

operations = [[0,1,3],[0,4,2],[1,3,4],[1,3,2]]return = [true,false]

Both saved rectangles fit the 3 × 4 box after choosing the appropriate orientation. The 4 × 2 rectangle cannot fit the later 3 × 2 box, so the answers are [true,false].

Constraints

  • operations contains at least one row.
  • operations[i].length = 3.
  • operations[i][0] is either 0 or 1.
  • operations[i][1] and operations[i][2] are positive integers.

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

  • HTTP Request RedirectionAmazon · OA
  • Streamed Planar Item TripletsGoogle · ONSITE INTERVIEWGoogle interview questions
  • Bank Accounts with Balance HistoryMeta · OAMeta interview questions
  • Request Routing SystemStripe · OAStripe interview questions
  • Count Overlapping Square PairsRamp · OARamp 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

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 boolean[] solution(int[][] operations) {
      // Write your code here.
    }
}
Checking account…