You are viewing a single comment's thread. Return to all comments →
JS
function factorial(n){ if(n < 0){ return -1; } if(n == 0 || n == 1){ return 1; }else{ return n * factorial(n-1); } } let value = input.split(/[\n]/g); let x = parseFloat(value[0]); let y = parseFloat(value[1]); let ans = (Math.pow(x,y) * Math.exp(-x))/factorial(y); console.log(ans.toFixed(3));
Seems like cookies are disabled on this browser, please enable them to open this website
Day 5: Poisson Distribution I
You are viewing a single comment's thread. Return to all comments →
JS