FastPrepUnexpected Demand
Problems/Unexpected Demand

Unexpected Demand

Roblox logoRoblox● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The candidate names Unexpected Demand and links a similar task. A separate reference for the well-known task gives the goal of filling the full order and the limits. Its image is a reference, not the candidate's own screenshot. Our version is about 95% the same as the reported question.

You have stock widgets and customer orders with quantities in orders. An order counts as fulfilled only when its entire quantity is supplied. Each order may be fulfilled at most once.

Return the maximum number of orders that can be fulfilled without using more than stock widgets. You may choose orders in any order and leave stock unused. For this exercise, assume the input array must remain unchanged; partially supplying an order does not count.

Function

filledOrders(orders: int[], stock: int) → int

Examples

Example 1

orders = [10,30]stock = 40return = 2

Both orders can be fulfilled exactly.

Example 2

orders = [5,4,6]stock = 3return = 0

No individual order can be fulfilled in full.

Example 3

orders = [8,2,3,9]stock = 6return = 2

Choose quantities 2 and 3; the remaining widget cannot complete another order.

Constraints

  • 1 <= orders.length <= 200000.
  • 1 <= orders[i] <= 1000000000.
  • 1 <= stock <= 1000000000.

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

  • Catch Fish with Reusable BaitsSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
  • Maximum Apples That Fit in a BoxVirtu Financial · OAVirtu Financial interview questions
  • Server ManagementRippling · OARippling interview questions
  • Maximum Three-Server Difficulty ScoreVisa · OAVisa interview questions
  • Economical TripAccenture · OAAccenture interview questions
  • Minimum Pile Reduction StepsAmerican Express · OAAmerican Express interview questions
  • Find Maximum Number of Subjects Passed (AS Intern, but it may apply to other interns) 🍋Amazon · OA
  • Maximum Production Within PowerZomato / Eternal · OAZomato / Eternal interview questions
  • Can Every Package Fit in a BoxIMC Trading · OAIMC Trading interview questions
  • Compute Walking DistanceTikTok · OATikTok interview questions

Interview reports that mention this question

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

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 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 filledOrders(int[] orders, int stock) {
        // write your code here
    }

}
Checking account…