# Employee rating | hackerearth solution

Problem

You are an IT company's manager. Based on their performance over the last N working days, you must rate your employee. You are given an array of N integers called workload, where workload[i] represents the number of hours an employee worked on an ith day. The employee must be evaluated using the following criteria:

• Rating = the maximum number of consecutive working days when the employee has worked more than 6 hours.

You are given an integer where N represents the number of working days. You are given an integer array workload where workload[i] represents the number of hours an employee worked on an ith day.

Determine the employee rating.

Example

Assumptions

• N = 12
• workload = [2, 3, 7, 8, 7, 6, 3, 8, 12, 11, 12, 10]

Approach

Workload with consecutive hours > 6 = [2, 3, 7, 8, 7, 6, 3, 8, 12, 11, 12, 10] =>  Longest Interval =  [8,12,11,12,10]

Therefore return 5.

Function description

Complete the Solve() function provided in the editor below that takes the following arguments and returns the employee rating:

• N: Represents the number of working days
• workload: where workload[i] represents the number of hours an employee worked on an ith day

Input format

• The first line contains an integer N denoting the number of working days.
• The second line contains a space-separated integer array workload where workload[i] represents the number of hours an employee worked on an ith day.

Output format

Print the employee rating.

Constraints

$1\le �\le {10}^{5}$

$1\le ��������\left[�\right]\le 12$

Sample Input
7
3 7 8 12 4 9 8
Sample Output
3
Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

Workload with consecutive hours > 6 = [7 8 12 4 9 8] =>  Longest Interval = [7 8 12]

Therefore, return 3.

Code(C++):-

#include<bits/stdc++.h>
using namespace std;
int solve (int N, vector<int> workload) {
int count=0;
int temp=0;
for(int i=0;i<N;i++){
count++;
}
else{
temp=max(temp,count);
count=0;
}
}
return temp;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N;
{
}
int out_;
cout << out_;
}

Code(JAVA):-

import java.io.*;
import java.util.*;
public class TestClass {
public static void main(String[] args) throws IOException {
PrintWriter wr = new PrintWriter(System.out);
{
}
System.out.println(out_);
wr.close();
br.close();
}
static int solve(int N, int[] workload){
int result = 0;
int temp = 0;
for(int i = 0; i < N; i++){
temp++;
}else{
if(temp > result){
result = temp;
}
temp = 0;
}
}
return result;
}
}

### Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-
iMocha coding Questions:-
Tech Mahindra coding questions:-
Unthinkable Solutions coding questions:-