Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Microsoft Question - MaxEmployeeAttendence (original question)
//g++ 7.4.0 // https://leetcode.com/discuss/interview-experience/1930164/Microsoft-or-SDE2-or-Hyderabad-or-April-2022-Reject #include <bits/stdc++.h> using namespace std; const int total_days = 10; const int repititions = 2; /* * availability[i] - list of days on which ith employee will be available to take the training. [0 <= availability[i][j] < D] * * total_days (D) - total number of days in which the training can be conducted. * * repititions (R) - number of times the training will be repeated in 'total_days' duration. * **/ int MaxEmployeeAttendence (vector<vector<int>>& availability) { int max_attendence = 0; for (int day1 = 0; day1 < total_days; day1 ++) { for (int day2 = day1+1; day2 < total_days; day2 ++) { int unique_employees = 0; for (int employee = 0; employee < availability.size(); employee ++) { for (int day : availability[employee]) { if (day == day1 || day == day2) { unique_employees ++; break; } } } if (max_attendence < unique_employees) max_attendence = unique_employees; } } return max_attendence; } int main() { vector<vector<int>> availability = { {0, 3, 9}, {4}, {1, 4}, {3, 2}, {3, 4}, {7} }; cout << MaxEmployeeAttendence (availability) << endl; return 0; }
run
|
edit
|
history
|
help
0
https://rextester.com/TXKE53925
sejmie
CharSearch
Korelacja Pearsona lol
std_minmax_unexpected_behaviour.cpp
Cross Multiplication
string
StrStrPbrk
День Программиста
FuktExam.cpp