FastPrepFactory Batch Profit (Game Adaptation)
Problems/Factory Batch Profit (Game Adaptation)

Factory Batch Profit (Game Adaptation)

Roblox logoRoblox● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This is a game version that we wrote. The candidate reports buying machines and materials and setting up production to get the most factory profit. They did not report this as a coding question. We chose independent production batches, up-front capital, prices, the limits, and the function below. Our version is about 45% the same as the reported question.

Game model. A factory produces batches of several product types under a fixed budget.

For this exercise, assume product type i costs costs[i] to produce one batch and earns revenues[i] when that batch is sold. You may produce any nonnegative integer number of batches of each type.

All production costs must be paid from the initial budget before any batch is sold. Sales cannot be reinvested in this run. Batches do not share machines or constrain one another. Return the maximum net profit: total sales revenue minus total production cost. You may leave capital unused or produce nothing. Keep the inputs unchanged.

Function

maxFactoryProfit(costs: int[], revenues: int[], budget: int) → int

Examples

Example 1

costs = [2,3]revenues = [5,7]budget = 7return = 10

Two batches of the first product and one of the second cost 7 and sell for 17, giving profit 10.

Example 2

costs = [5]revenues = [3]budget = 10return = 0

Every batch loses money; producing nothing is best.

Example 3

costs = [4,6]revenues = [9,14]budget = 12return = 16

Two batches of the second product earn 28 and cost 12, beating three batches of the first.

Constraints

  • 1 <= costs.length == revenues.length <= 30.
  • 1 <= costs[i] <= 100; 0 <= revenues[i] <= 1000.
  • 0 <= budget <= 2000.
  • The returned profit fits a signed 32-bit integer.

More Roblox Online Assessment questions

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

  • 0/1 KnapsackConfluent · OAConfluent interview questions
  • Minimum Cost to Tile a Strip with Widths 1, 2, and 3Infosys · OAInfosys interview questions
  • Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
  • Maximum Subarray SumStraive · OA
  • Longest Increasing Price SubsequenceOpenAI · OAOpenAI interview questions
  • Lowest-Cost Shirt Color ScheduleElevenLabs · OAElevenLabs interview questions
  • Maximum Game Board ScoreJP Morgan Chase · OAJP Morgan Chase interview questions
  • API Bandwidth AllocationArista Networks · OAArista Networks interview questions
  • Maximum Points by Deleting ElementsIBM · OAIBM interview questions
  • House RobberWalmart · OAWalmart interview questions

Interview reports that mention this question

  • 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)
  • Roblox New Grad OA and Interviews: 137 Experiences (Part 1 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)
All Roblox interview questionsSee Roblox hiring insights
Saved
class Solution {
    public int maxFactoryProfit(int[] costs, int[] revenues, int budget) {
        // write your code here
    }

}
Checking account…