FastPrepFactorial Without Multiplication
Problems/Factorial Without Multiplication

Factorial Without Multiplication

Wayve logoWayve● EasyFULLTIMEPHONE SCREEN
QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand Wayve interview report published September 16, 2026 asks for factorial recursively, iteratively, and without multiplication, including invalid-input and complexity discussion. This judged version isolates the hardest restriction and declares the safe 32-bit input range.

Return n! without using the multiplication operator. Implement multiplication through repeated addition. Return -1 when n is outside the supported range 0..12.

Function

factorialWithoutMultiplication(n: int) → int

Examples

Example 1

n = 5return = 120

Repeated addition builds 1 × 2 × 3 × 4 × 5 = 120 without using the multiplication operator.

Example 2

n = 0return = 1

By definition, zero factorial is one.

Constraints

  • -100 <= n <= 100
  • Do not use multiplication in the submitted function.

More Wayve problems

  • Longest Stationary Sensor IntervalPHONE SCREEN
  • Non-Maximum SuppressionPHONE SCREEN
See Wayve hiring insights
Saved
class Solution {
    public int factorialWithoutMultiplication(int n) {
      // Write your code here.
    }

}
Checking account…