FastPrepNested Recipe Blocks (Game Adaptation)
Problems/Nested Recipe Blocks (Game Adaptation)

Nested Recipe Blocks (Game Adaptation)

Roblox logoRoblox● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This is a game version that we wrote. A candidate reports taking Outpost:Mars. Roblox has a public practice called Coding Cookies that separately confirms its block-coding interface. The candidate did not share a level or a program. The ADD, REPEAT and END instructions, the arithmetic, the limits, and the output below are a drill that we wrote, not a rebuilt puzzle from the assessment. Our version is about 30% the same as the reported question.

This is a small block-program execution drill.

For this exercise, a recipe counter starts at zero. Each string in program is one instruction: ADD x adds nonnegative integer x; REPEAT k repeats the following block exactly k times; and END closes the most recent REPEAT block. Blocks may be nested, and a repeat count of zero skips the entire block.

The instructions always follow these rules, and every REPEAT has a matching END. Return the final counter as a signed 64-bit integer. Do not change the program array. Empty programs and empty repeated blocks are allowed.

Function

executeRecipeBlocks(program: String[]) → long

Examples

Example 1

program = ["ADD 2","REPEAT 3","ADD 4","END"]return = 14

The initial 2 is followed by three additions of 4.

Example 2

program = ["REPEAT 2","ADD 1","REPEAT 3","ADD 2","END","END"]return = 14

Each outer iteration adds 1+3×2=7; two iterations give 14.

Example 3

program = ["REPEAT 0","ADD 100","END","ADD 5"]return = 5

The zero-count block contributes nothing.

Constraints

  • 0 <= program.length <= 200.
  • 0 <= x <= 1000; 0 <= k <= 10.
  • At most six REPEAT blocks are nested at one time.
  • Instructions use exactly the shown uppercase opcode and one space before each integer argument.
  • The largest possible counter is at most 200 × 1000 × 10^6, safely within signed 64-bit and exact JSON integer range.

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
  • 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

  • Compress Editor Actions into Operational Transform OperationsReplit · OA · PHONE SCREEN · ONSITE INTERVIEW
  • Compare Character Arrays with BackspacesOdoo · OAOdoo interview questions
  • Flatten a Mixed JSON ListNike, Inc. · ONSITE INTERVIEWNike, Inc. interview questions
  • Trace Events from Stable Whole-Stack StatesAnthropic · ONSITE INTERVIEWAnthropic interview questions
  • Earliest Time to Schedule a MeetingMathWorks · OAMathWorks interview questions
  • Earliest Meeting Start on a 24-Hour ClockIMC Trading · OAIMC Trading interview questions
  • Sum of Subarray MinimumsNVIDIA · OANVIDIA interview questions
  • Count One-Swap Number PairsCapital One · OACapital One interview questions
  • Earliest Time to Schedule a MeetingMicrosoft · OAMicrosoft interview questions
  • Substring RemovalJP Morgan Chase · OAJP Morgan Chase interview questions

Interview reports that mention this question

  • 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)
  • Roblox New Grad HackerRank OA: 18 Experiences (Part 5 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)
All Roblox interview questionsSee Roblox hiring insights
Saved
class Solution {
    public long executeRecipeBlocks(String[] program) {
        // write your code here
    }

}
Checking account…