You are viewing a single comment's thread. Return to all comments →
Super Lazy Approach
public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); scan.useDelimiter("\r\n"); String string = scan.next(); int size = scan.nextInt(); List<String> list = new LinkedList<String>(); final int max = string.length() - size; for (int i = 0; i <= max; i++) { list.add(string.substring(i, i + size)); } System.out.println(Collections.min(list)); System.out.println(Collections.max(list)); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Substring Comparisons
You are viewing a single comment's thread. Return to all comments →
Super Lazy Approach