K-Repetitiveness Feature Value
Problem Overview
- Given a user's purchase history string, compute the k-repetitiveness feature: the number of substrings where some product category appears at least k times.
- Input: user_history (lowercase a-z, length 1 to 5e4) and integer k (1 to 5e4). Output: an integer count.
- Context: feature engineering for Amazon's recommendation system using purchase history data.
- This coding interview problem is an Amazon interviews interview question focused on string analysis and counting substrings.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
