Company: Netcore backend dev_2nov
Difficulty: medium
Special shoes Problem Description Mike owns N shoes, numbered from 1 to N. Each shoe belongs to one of the 62 possible varieties, represented by unique alphanumeric characters (a-z, A-Z, 0-9). A string S of length N describes the type of each shoe, where the i th character of S denotes the variety of the i th shoe. Among these varieties, K types are considered special and are listed in another string of length K. Mike needs to choose a consecutive range of shoes from position A to B (1 ≤ A ≤ B ≤ N) to display at an exhibition. He wants the selected segment to contain at least L and at most R special shoes in total. Your task is to determine how many pairs of (A, B) can satisfy this condition. Function description Complete the function solved provided in the editor. This function takes the following 6 parameters and returns the required answer. N : Represents the number of shoes. K : Represents the number of special shoe types. L : Represents the minimum number of special shoes