Accenture OA-23 2024
Problem Description
You are working on a financial analyzing tool which represents the daily stock prices of a company over a time. Each element in an integer array A of size N represents the closing price of the stock for a particular day. Your task is to find and return an integer value representing the total number of days where the stock price decreased, indicating negative growth.
Input Format:
- input1: An integer array A containing the closing price of the stock.
- input2: An integer value N representing the size of array
Output Format:
Return an integer value representing the total number of days where the stock price decreased, indicating negative growth.
Constraints:
- 1 ≤ N ≤ 10^5
- 1 ≤ A[i] ≤ 10^9, for every 1 ≤ i ≤ N
Example
Sample Input:
input1: [3, 5, 6, 7, 9, 10, 12]
input2: 7
Sample Output:
0
Explanation:
In this example, the stock price is increasing every day. Hence, there are no days with negative growth.