Company: citi_14oct
Difficulty: medium
Largest Pothole Indicator Problem Description A road is divided into N segments, numbered 0 through N-1, and its condition is described by an array R of integers. Segment K is smooth when R[K] = 0; otherwise R[K] is the depth of a pothole sitting there. Whenever potholes occupy consecutive segments, they merge into a single, larger pothole group. The pothole indicator of a group is the number of consecutive segments that merged together, multiplied by the greatest depth found among them. For instance, a group formed from three consecutive potholes of depths [1, 4, 1] has indicator 3 * 4 = 12. What is the largest pothole indicator found anywhere along the whole road? Write a function: int solution(vector<int> &R); that, given an array R of N integers, returns the largest pothole indicator on the road. Examples Example 1: Input: R = [0, 2, 1, 1, 0, 4, 1] Output: 8 Explanation: The potholes forming the fragment [2, 1, 1] merge into one group. It spans three segments and its deep