Company: oracle_28aug
Difficulty: medium
Bullish Trend Detection Problem Description You are building a backend service for a stock analytics platform. You have an array named stockPrices where stockPrices[i] denotes the price of the stock in the i th month. A bullish trend of size k is an interval of k months such that the stock prices increase strictly throughout those months. Implement a function that calculates the number of bullish trends of size k . The function calculateBullishTrends takes the following inputs: int stockPrices[] : the stock prices for n months int k : the analysis parameter The function should return an integer, the number of bullish trends of size k . Note: If the interval length is 1, each subarray of length 1 is highly profitable. Examples Example 1: Input: stockPrices = [1, 2, 3, 3, 4, 5], k = 3 Output: 2 Explanation: These are the intervals of k months in which the stock prices are strictly increasing: Months 1 to 3: [1, 2, 3] (1 < 2 < 3) Months 4 to 6: [3, 4, 5] (3 < 4 < 5) Hence, the