Bullish Trend Detection

Company: oracle_8sep

Difficulty: medium

Problem Statement

Bullish Trend Detection Problem Description You are building a backend service for a stock analytics platform. You need to identify bullish trends: contiguous intervals of months in which the stock price increases strictly from month to month. You are given an array stockPrices where stockPrices[i] is the price of the stock in month i + 1 , and an integer k . A bullish trend of size k is a contiguous interval of exactly k months such that the stock prices increase strictly throughout those months. Implement the function calculateBullishTrends(stockPrices, k) , which returns the number of bullish trends of size k . Input Format Read from standard input. n stockPrices[0] stockPrices[1] ... stockPrices[n-1] k The first line contains n , the number of months. Each of the next n lines contains one integer, the stock price of that month, in month order. The last line contains k , the length of the trend. Output Format Print a single integer: the number of contiguous intervals of exactly k mo