Repeated Substring Pattern: Leetcode tough KMP and Robin Karp Algorithm

https://leetcode.com/problems/repeated-substring-pattern/

Easy But tough for me as I do not know two of the algorithms

1. Knuth-Morris-Pratt Algorithm and

2. Divisors + Rabin-Karp

Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters only…