Untitled
bool canBeComposed(int n, int x) { // Base cases if (n == 0) return true; if (n < 0) return false; // Try to break `n` using `x` bool usingX = canBeComposed(n - x, x); // Try to break `n` using `x-1` bool usingXMinusOne = canBeComposed(n - x + 1, x); return usingX || usingXMinusOne; }