Company: Apple
Difficulty: medium
Longest Profit Problem Description You are given an array of integers, which represent the monthly net profits of a company. The company wants you to look for the longest sequence of chronologically ordered months that have increasing profit, and return the length. The sequence can include non-adjacent months. Implement the method `LongestProfit(int[] data)` which takes as input an array of integers `data`, representing a given set of consecutive monthly profit values. Examples Example 1: Input: data = [-1, 9, 0, 8, -5, 6, -24] Output: 3 Explanation: The longest sequence of increasing monthly profits has a length of 3. Possible sequences include `[-1, 0, 6]` or `[-1, 0, 8]`.