Problem Β· Array
Plan Cuts π‘
Learn this problemProblem 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) β StringExamples
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
- Minimize Total Input Cost (for LTMS)Seen Jun 2026
- Count Prime StringsONSITE INTERVIEW Β· Seen Jun 2026
- Final Pod Counts After LogsOA Β· Seen May 2026
- ATM Queue Exit OrderPHONE SCREEN Β· Seen May 2026
- Good Ways to Split an ArrayPHONE SCREEN Β· Seen May 2026
- Generate Seen Binary StringsOA Β· Seen May 2026
- Update Pod Counts From LogsOA Β· Seen May 2026
- Minimum Removals to Balance ArrayOA Β· Seen May 2026