FastPrepPlan Cuts 🐑
Problems/Plan Cuts 🐑

Plan Cuts 🐑

Salesforce logoSalesforce● MediumOA
QuestionFunctionExamplesConstraints

Problem statement

An automated cutting machine is used to cut rods into segments. The cutting machine can only hold a rod of minLength or more. A rod is marked with the necessary cuts and their lengths are given as an array in the order they are marked. Determine if it is possible to plan the cuts so the last cut is from a rod at least minLength units long.

Function

planCuts(rodLengths: int[], minLength: int) β†’ String

Examples

Example 1

rodLengths = [3, 5, 4, 3]minLength = 9return = "Possible"

N/A for now πŸ‘‰πŸ™‰πŸ‘ˆ

Example 2

rodLengths = [4, 3, 2]minLength = 7return = "Possible"

N/A for now

Example 3

rodLengths = [4, 2, 3]minLength = 7return = "Impossible"

N/A for now

Example 4

rodLengths = [5, 6, 2]minLength = 12return = "Impossible"

N/A for now

Constraints

  • Unknown for now πŸ₯²

More Salesforce problems

  • Count Subarrays With Product Equal to KOA Β· Seen Nov 2026
  • Minimum No-Repeat Segments After One Character RemovalOA Β· Seen Nov 2026
  • Get Message StatusOA Β· Seen Nov 2026
All Salesforce interview questionsSee Salesforce hiring insights
Saved
public String planCuts(int[] rodLengths, int minLength) {
    // write your code here
}
Checking account…