FastPrepLifting Weights
Problems/Lifting Weights

Lifting Weights

Roblox logoRoblox● HardNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The candidate's original screenshot asks for the largest total weight of plates you can pick without going over the capacity, using each plate at most once. This version keeps its example and limits and leaves the input unchanged. Our version is about 100% the same as the reported question.

Select a subset of the plates in weights whose total weight does not exceed maxCapacity. Each array occurrence is one plate and may be selected at most once, even when several plates have the same weight.

Return the maximum possible total weight. The empty subset is allowed and has weight 0. Maximize weight rather than the number of plates; no left/right symmetry requirement is imposed. For this exercise, assume the input array must remain unchanged.

Function

weightCapacity(weights: int[], maxCapacity: int) → int

Examples

Example 1

weights = [1,3,5]maxCapacity = 7return = 6

The subset 1+5 has weight 6, the largest total not exceeding 7.

Example 2

weights = [8,9]maxCapacity = 7return = 0

Neither plate fits, so choose the empty subset.

Example 3

weights = [4,4,6]maxCapacity = 8return = 8

The two distinct 4-weight plates may both be selected.

Constraints

  • 1 <= weights.length <= 42.
  • 1 <= weights[i], maxCapacity <= 1000000000.
  • The returned selected total is at most maxCapacity and fits an int; intermediate arithmetic uses wider values where needed.

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

  • Split Array to Minimize the Largest SumInfosys · OAInfosys interview questions
  • Sliding Window MedianAuxoAI · OA
  • Maximum Barbell WeightVirtu Financial · OAVirtu Financial interview questions
  • Maximum Non-Decreasing Array LengthVisa · OAVisa interview questions
  • Minimum Cost to Make Array EqualWalmart · OAWalmart interview questions
  • Maximize Array Beauty After DeletionsPoint72 · OAPoint72 interview questions
  • Longest Subarray with Sum at Most KGoogle · OAGoogle interview questions
  • Maximum Barbell WeightSalesforce · OASalesforce interview questions
  • Data ReorganizationGoldman Sachs · OAGoldman Sachs interview questions
  • Find Least Possible VulnerabilityAmazon · OA

Interview reports that mention this question

  • Roblox New Grad Engineer Rounds: 13 Experiences (Part 6 of 7)
  • 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 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 weightCapacity(int[] weights, int maxCapacity) {
        // write your code here
    }

}
Checking account…