General performance improvement (#6078)

This commit is contained in:
Strange Developer
2024-11-01 18:52:42 +01:00
committed by GitHub
parent 7b962a4a1d
commit df0c997e4b
29 changed files with 92 additions and 75 deletions

View File

@@ -1,7 +1,8 @@
package com.thealgorithms.maths;
import static java.util.Collections.singletonList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import org.apache.commons.lang3.tuple.MutablePair;
@@ -16,7 +17,7 @@ import org.apache.commons.lang3.tuple.MutablePair;
* - the base [2, 3, 5] ugly numbers are the same as base [5, 6, 2, 3, 5] ugly numbers
*/
public class NthUglyNumber {
private ArrayList<Long> uglyNumbers = new ArrayList<>(Arrays.asList(1L));
private ArrayList<Long> uglyNumbers = new ArrayList<>(singletonList(1L));
private ArrayList<MutablePair<Integer, Integer>> positions = new ArrayList<>();
/**