FastPrepEfficient Janitor Trips
Problems/Efficient Janitor Trips

Efficient Janitor Trips

Roblox logoRoblox● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The candidate names Efficient Janitor and links a grouping task with weights from 1.01 to 3 and a capacity of 3. We assume weights have two decimals, written as whole hundredths. We also chose the interface, the limits, and the empty case. Our version is about 90% the same as the reported question.

A janitor must carry every bag exactly once. For this exercise, weights are given in integer hundredths of a kilogram: 101 means 1.01 kg, and 300 means 3.00 kg. One trip carries at most 300 hundredths in total.

Return the minimum number of trips needed to carry all bags. You cannot split a bag, and you may group the bags in any order. Since every bag weighs at least 101, no trip can hold three bags. Do not change the input array. No bags requires zero trips.

Function

minJanitorTrips(weights: int[]) → int

Examples

Example 1

weights = [101,101,300,270,199,230,170]return = 5

Pair 101 with 199 and the other 101 with 170; 300, 270 and 230 travel alone.

Example 2

weights = [150,150,150,150]return = 2

Two pairs weigh exactly 300 each.

Example 3

weights = []return = 0

There are no bags to carry.

Constraints

  • 0 <= weights.length <= 100000.
  • 101 <= weights[i] <= 300, with integer hundredths used to represent two-decimal precision.
  • Every bag must be included in exactly one trip, and every trip’s weight is at most 300.

More Roblox Online Assessment questions

  • Centered Block Placement QueriesOA · Seen Oct 2026
  • 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

Similar questions at other companies

  • Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
  • Latest Arrival to Catch a BusAutodesk · OAAutodesk interview questions
  • Minimum Removals to Balance ArraySalesforce · OASalesforce interview questions
  • Minimum Machines for TasksExpedia · OAExpedia interview questions
  • Find Minimum Possible SizeMathWorks · OAMathWorks interview questions
  • Minimum Days to Watch All MoviesAdobe · OAAdobe interview questions
  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Can Every Package Fit in a BoxIMC Trading · OAIMC Trading interview questions
  • Minimum Tunnel Crossing TimeArcesium · OAArcesium interview questions
  • Get Maximum PairsAmazon · OA

Interview reports that mention this question

  • Roblox New Grad Early OA Tasks: 10 Experiences (Part 7 of 7)
  • Roblox New Grad HackerRank OA: 18 Experiences (Part 5 of 7)

Roblox interview experiences

  • Roblox New Grad Engineer Rounds: 13 Experiences (Part 6 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)
  • Roblox New Grad Coding Rounds: 23 Experiences (Part 2 of 7)
All Roblox interview questionsSee Roblox hiring insights
Saved
class Solution {
    public int minJanitorTrips(int[] weights) {
        // write your code here
    }

}
Checking account…