Optimal Division
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Given an array nums of integers, write them in order with / between neighbours, e.g. [2,3,4] gives 2/3/4,
which is evaluated left to right. You may add parentheses anywhere to change the evaluation order.
Return the expression, as a string, that achieves the **maximum** value. The string must contain no redundant
parentheses: only add parentheses that change the evaluation, and never wrap a single number or the entire
expression. With all values at least 2, this expression is unique.
Examples
Constraints
- 1 <= nums.length <= 10
- 2 <= nums[i] <= 1000
- There is exactly one optimal expression for every valid input
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.