diff --git a/src/main/java/com/develogical/app/QueryProcessor.java b/src/main/java/com/develogical/app/QueryProcessor.java index cbaddfb..ec1e84f 100644 --- a/src/main/java/com/develogical/app/QueryProcessor.java +++ b/src/main/java/com/develogical/app/QueryProcessor.java @@ -107,8 +107,20 @@ else if (query.toLowerCase().contains("primes")) { } } + + int[] ansList = new int[ans.size()]; + int index = 0; + for (String s : ans) { + ansList[index++] = (Integer.valueOf(s)); + } + Arrays.sort(ansList); + + String k = ""; + for (int i : ansList) { + k += i + ","; + } - return String.join(", ", ans); + return k; } @@ -148,7 +160,7 @@ public boolean isPrime(int n) { } public int fib (int n) { - int a = 0; + int a = 1; int b = 1; for (int i = 0; i < n-1; i++) {