Company: Amazon_july
Difficulty: medium
Calculate Repetitiveness Feature Problem Description The team of machine learning scientists at Amazon wants to improve Amazon's product recommendation system. Based on a user's purchase history, the objective is to generate some extensive features that will be given as input to the machine learning model. One of the new proposed features is a minRepetitions-repetitiveness feature whose computation is described below. The purchase history of a user with the products available on Amazon is available in the form of a string purchaseHistory where the i th character represents the category of the i th product purchased by the user. The length of string purchaseHistory is n . There is also a given integer minRepetitions . The value of the minRepetitions-repetitiveness feature for the string purchaseHistory is defined as the maximum number of substrings of the given string such that some product category in that substring appeared at least minRepetitions times. Find the value of the minRepet