Connection Status:
Competition Arena > WhichDay
SRM 519 · 2011-05-25 · by misof · Simple Search, Iteration, String Manipulation
Class Name: WhichDay
Return Type: String
Method Name: getDay
Arg Types: (vector<string>)
Problem Statement

Problem Statement

This week there will be an important meeting of your entire department. You clearly remember your boss telling you about it. The only thing you forgot is the day of the week when the meeting will take place.

You asked six of your colleagues about the meeting. None of them knew the day when it will take place, but each of them remembered one day when it will not take place. The days they remembered were distinct. For a clever programmer like you, this was enough to determine the day of the meeting.

You are given a String[] notOnThisDay containing six weekdays when the meeting will not take place. Return the weekday of the meeting.

Notes

  • There are seven weekdays. Their names are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday".

Constraints

  • notOnThisDay will contain exactly 6 elements.
  • Each element of notOnThisDay will be a name of a weekday (in the exact form specified in the Note above).
  • No two elements of notOnThisDay will be equal.
Examples
0)
{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}
Returns: "Saturday"
1)
{"Sunday", "Monday", "Tuesday", "Wednesday", "Friday", "Thursday"}
Returns: "Saturday"
2)
{"Sunday", "Monday", "Tuesday", "Thursday", "Friday", "Saturday"}
Returns: "Wednesday"
3)
{"Sunday", "Friday", "Tuesday", "Wednesday", "Monday", "Saturday"}
Returns: "Thursday"
4)
{ "Friday" , "Monday" , "Thursday" , "Tuesday" , "Sunday" , "Saturday" }
Returns: "Wednesday"

Submissions are judged against all 78 archived test cases, of which 5 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class WhichDay with a public method string getDay(vector<string> notOnThisDay) · 78 test cases · 2 s / 256 MB per case

Submitting as anonymous