Computers and Technology
There is a new product launched and its customer ratings are being recorded in an array. the ratings are being monitored and analyzed if there is any decrease in the ratings. find the number of periods in which the rating is consecutively decreasing.example - ratings = [4,3,5,4,3]periods (in other words sub arrays in which ratings are decreasing):one day periods = [4],[3],[5],[4],[3] (count of subarrays is 5)two day periods = [4,3],[5,4],[4,3] (count of subarrays is 3)3 day periods = [5,4,3] (count of subarrays is 1)so, the output for this example will be 9 (5 + 3 + 1)