Hackerrank Java Substring Comparisons Solution
Solution in java8
Approach 1.
public static String getSmallestAndLargest(String s, int k) {
String smallest = s.substring(0, k);
String largest = s.substring(0, k);
for(int i = 0; i <= s.length() - k; i++){
String sTemp = s.substring(i, i + k);
if(sTemp.compareTo(smallest) < 0) {
smallest