-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
11 changes: 9 additions & 2 deletions
11
big-o/src/main/java/com/josdem/algorithms/PlusTimeRunner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
package com.josdem.algorithms; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/* Type: Plus Time Algorithms – O(2a + b) | ||
Description: Plus compute time algorithm | ||
*/ | ||
public class PlusTimeRunner { | ||
|
||
public List<Integer> getList() { | ||
return null; | ||
public List<Integer> createNewList(List<Integer> numbers) { | ||
int min = numbers.stream().min(Integer::compare).orElseThrow(() -> new RuntimeException("No min value was found")); | ||
int max = numbers.stream().max(Integer::compare).orElseThrow(() -> new RuntimeException("No max value was found")); | ||
return Arrays.asList(new Integer[max - min + 1]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters