Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Gonza's test - Disk Space Analysis.
- const n = 3 // The length of segments.
- const space = [2, 5, 4, 6, 8];
- const x = 5 // The length of analysis segments (Size of space).
- function functionTest(n, space) {
- let segmentList = [];
- for (let i = 0; i < n; i++) {
- let tempArray = [];
- let tempIndex = i;
- for (let o = 0; o < n; o++) {
- tempArray.push(space[tempIndex]);
- tempIndex++;
- }
- // We obtain the minimum value from the previous array.
- segmentList.push(Math.min(...tempArray));
- }
- // Return the max value from the previous minimum values.
- let maxValue = Math.max(...segmentList);
- return maxValue;
- }
- console.info(functionTest(n, space));
Advertisement
Add Comment
Please, Sign In to add comment