Clumsy Factorial
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
The *clumsy factorial* of a positive integer n writes the integers n, n-1, ..., 1 in decreasing order and places the operators *, /, +, - between consecutive numbers, cycling through them in that order. For example, clumsy(10) = 10 * 9 / 8 + 7 - 6 * 5 / 4 + 3 - 2 * 1.
The expression is evaluated with normal precedence: all * and / are done before + and -, left to right within each group. Division is integer division that rounds toward zero (every quotient here is between positive numbers, so this is the same as flooring).
Return clumsy(n).
Examples
Constraints
- `1 <= n <= 10^4`
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.