Tests

 avatar
unknown
typescript
5 months ago
336 B
2
Indexable
const pathLength = 100;
const daylyIncrease = 50;
const daylyDecrease = 30;

function calcDaysToGoal(goal:number, increase:number, decrease:number) {
    const profit = increase-decrease
    const days = Math.ceil(goal/profit)
    const canOnPreviousDay = (days-1)*profit+decrease>=goal
    return canOnPreviousDay? days-1: days
}

// 4
Editor is loading...
Leave a Comment