typescript algorithm to find repeating number sequences over time

Solutions on MaxInterview for typescript algorithm to find repeating number sequences over time by the best coders in the world

showing results for - "typescript algorithm to find repeating number sequences over time"
Olivia
11 Sep 2019
1String arr[] = {"12341234abc", "1234foo1234", "12121212", "111111111", "1a1212b123123c12341234d1234512345"};
2String regex = "(\\d+?)\\1";
3Pattern p = Pattern.compile(regex);
4for (String elem : arr) {
5    boolean noMatchFound = true;
6    Matcher matcher = p.matcher(elem);
7    while (matcher.find()) {
8        noMatchFound = false;
9        System.out.println(elem + " got repeated: " + matcher.group(1));
10    }
11    if (noMatchFound) {
12        System.out.println(elem + " has no repeation");
13    }
14}
15