NodeJs Expert to write a Method to Calculate

Job ID: 34849218

Budget: $10 – $30 USD

A helicopter needs to deliver a package of spice to the city of Arrakis. The helicopter navigator has spotted a package of spice on the dune located a few meters from it. It is known that every helicopter can only move in steps that have a predetermined length (in meters).
Write a function that gets:
distance - the distance between the helicopter and the package of spice in meters
possibleSteps - the length of the steps that the helicopter can take
The function should return the number of different paths for the helicopter to get to the package.

For example, if the box is located 4 meters from the helicopter and the possible steps are of length [1, 2], there are exactly 5 paths:
1 - 1 - 1 - 1
1 - 1 - 2
1 - 2 - 1
2 - 1 - 1
2 - 2


Note: The helicopter starts at the 0th meter, and the number of paths to get from the 0th meter to the 0th meter is 1 (the only option is to stay in place).
Examples:
Input:
distance = 3
possibleSteps = [1]
Output: 1
Input:
distance = 3
possibleSteps = [1, 2]
Output: 3
Input:
distance = 6
possibleSteps = [1, 4, 5]
Output: 6
Input:
distance = 1
possibleSteps = [2, 3]
Output: 0

//fill the code here
'use strict';

function helicopterToPackageOfSpice(distance, possibleSteps) {
// Write your code here.
}


*** describing the algorithm you implemented for the question above. Make sure to address the runtime and memory complexity.
Related categories: JavaScript Python Node.js AngularJS