DEV Community

loading...

Discussion on: Complete the function without using loops and conditions

Collapse
alekseiberezkin profile image
Aleksei Berezkin

You need just to...

Solution
Solve the system of 2 linear equations:
48a + b = 52
52a + b = 48

And the solution is: a = -1, b = 100. So,

function calculate(n) {
    return -n + 100
}

Collapse
318097 profile image
Mehul Lakhanpal Author

Awesome 🔥👍