Problem Statement
Each element of schedule has 24 characters, and represents an hour-by-hour schedule of one plane. Each position in the string corresponds to an hour of the day; '1' (one) and '0' (zero) are the only characters allowed in the strings. When position X in the string contains '1', the plane is at the hub at the hour X; when the character is '0', the plane is not at the hub at that hour.
Definition
- Class:
- BusyHours
- Method:
- minMaxLoad
- Parameters:
- String[]
- Returns:
- int[]
- Method signature:
- int[] minMaxLoad(String[] schedule)
- (be sure your method is public)
Constraints
- schedule contains between 1 and 50 elements, inclusive
- Elements of schedule are exactly 24 characters in length
- Elements of schedule do not contain characters other than '0' (zero) and '1' (one).
Examples
{"010101010101010101010101", "101010101010101010101010"}
Returns: { 0, 0 }
{"010101010101010101010101", "010101010101010101010101"}
Returns: { 0, 1 }
{"110000000000001100000001", "110000000001111100000000", "000111110000000111100000"}
Returns: { 2, 15 }
{"110000000000001100000001", "110000000001111100000000", "000111110000000111100000", "000000000011110000000111", "111111100001111100000111", "100111110000000111100100"}
Returns: { 8, 15 }
{"110000000000001100000001", "110000000001111100000000", "000111110000000111100000", "000000000011110000000111", "111111100001111100000111", "100111110000000111100100", "110000000000001100000001", "110000000001111100000000", "000111110000000111100000", "000000001111110000000111", "111111100001111100000111", "100111110000000111100100"}
Returns: { 19, 15 }
{"110000000000001100000001", "110000000001111100000000", "000111110000000111100000", "000000000011110000000111", "111111100001111100000111", "100111110000000111100100", "110000000000001100000001", "110000000001111100000000", "000111110000000111100000", "000000000011110000000111", "111111100001111100000111", "100111110000000111100100", "110000000000001100000001", "110000000001111100000000", "000111110000000111100000", "000000001011110000000111", "111111100001111100000111", "100111110000000111100100"}
Returns: { 9, 15 }
{"000000000000000000000001", "100000000000000000000001", "000000000000000000000001", "000000000000000000000001"}
Returns: { 1, 23 }
{"101010101010101010101010", "101010101010101010101010", "101010101010101010101010"}
Returns: { 1, 0 }
{"000000000100000000000000"}
Returns: { 0, 9 }
{"110000000000001100000001", "110000000001111100000000", "000111110000000111100000"}
Returns: { 2, 15 }
{"000100000000000000000000"}
Returns: { 0, 3 }
{"111111111111111111111111", "000000110000000000000000"}
Returns: { 0, 6 }
{"111111111111111111111110"}
Returns: { 23, 0 }
{"111111111111111111111111", "111111111111111111111111"}
Returns: { 0, 0 }
{"010101010101010101010101", "101010101010101010101010"}
Returns: { 0, 0 }
{"111111111111111111111111", "010101010000000000000000"}
Returns: { 0, 1 }
{"010000000000000000000000", "001000000000000000000000", "010000000000000000000000"}
Returns: { 0, 1 }
{"111111111111111111111111", "101010101010101010101010"}
Returns: { 1, 0 }
{"101010101010101010101010"}
Returns: { 1, 0 }
{"000000000000000000000001", "000000000000000000000001", "000000000000000000000001", "000000000000000000000001"}
Returns: { 0, 23 }
{"101010101010101010101010", "101010101010101010101010"}
Returns: { 1, 0 }
{"111111111111111111111111"}
Returns: { 0, 0 }
{"100000000000000000000001", "010000000000000000000001"}
Returns: { 2, 23 }
{"111011111111111111111111", "111011111111111111111111"}
Returns: { 3, 0 }
{"111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111111", "111111111111111111111110"}
Returns: { 23, 0 }
{"010000000000000000000000", "010000000000000000000000"}
Returns: { 0, 1 }
{"010101010101010101010101", "101010101010101010101010"}
Returns: { 0, 0 }
{"101111111111111111111111", "101111111111111111111111", "101111111111111111111111"}
Returns: { 1, 0 }
{"111111111111111111111111", "111111111111111111111111", "111111111111111111111111"}
Returns: { 0, 0 }
{"000000000000100000000000"}
Returns: { 0, 12 }
{"010101010101010101010101", "101010101010101010101010"}
Returns: { 0, 0 }
{"000000000000000000000000"}
Returns: { 0, 0 }
{"001111111111111111111111", "001111111111111111111111", "001111111111111111111111"}
Returns: { 0, 2 }
{"000000000000000000000000"}
Returns: { 0, 0 }
{"110000000000001100000001", "110000000001111100000000", "000111110000000111100000"}
Returns: { 2, 15 }
{"111011111111111111111111", "111111111111111111111111"}
Returns: { 3, 0 }
{"010101010101010101000101", "101010101010101010101011", "101010101010101010101011", "101010101010101010101011"}
Returns: { 19, 23 }
{"110000000000001000000001", "110000000001110000000000", "000111110000000111100000", "000101010001000100000001", "110000000000001000000001", "110000000001110000000011", "000111010000000111100000", "000101010001000100000001", "100000000000000000000001", "110000000001110001000000", "000111110011100111100000", "000101010001000100000001", "110000000000001000000001", "110000000001010000000000", "000111110000000111100000", "000101010001000100000001", "110000000000001000000001", "110000000001110000000000", "000111110001000111100000", "000101010001000100000001", "110000111100001000000001", "110000000001110000010000", "000111110000000111100000", "000101010001000100010001", "110000000000001000000001", "110000000001110000110000", "000111110000000111100000", "000101010001000100000001", "110000001110001000000001", "110000000001110000000000", "000101110010000111100000", "000101010001000100000001", "110000010101001000000001", "110000000001110001000000", "000110110000000111100000", "000101010001000100100001", "110000010001001000000001", "110001000101110000000000", "000111110000000111100000", "000101010001000100000001", "110000000000001000000001", "110000000001110000000000", "000111110000000111100000", "000101010001000100000001", "110000000000001000000001", "110000000001110000010000", "000111110001000111100000", "000101010001000100000001", "110000000000001000000001", "110000000001110000001000"}
Returns: { 2, 11 }
{"000100010001000100010001", "000100010001000100010001", "000100010001000100010001", "000100010001000100010001", "000100010001000100010001", "000100010001000100010001", "000100010001000100010001", "000100010001000100010001", "000100010001000100010001", "000100010001000100010001", "000100010001000100010001"}
Returns: { 0, 3 }
{"010101010101010101010101", "111101010101010101010101"}
Returns: { 4, 1 }
{"111111111111111111111110", "000000000000000000000001"}
Returns: { 0, 0 }
{"010101010101010101010101", "101010101010101010101010"}
Returns: { 0, 0 }
{ "110000000000001100000001", "110000000001111100000000", "000111110000000111100000"}
Returns: { 2, 15 }
2 is the earliest hour when there are no planes at the hub, and 15 is the busiest hour, when all three planes are at the hub.
{ "010101010101010101010101", "101010101010101010101010"}
Returns: { 0, 0 }
All hours are equally loaded, and 0 is the earliest of them.
{ "010101010101010101000101", "101010101010101010101011", "101010101010101010101011", "101010101010101010101011"}
Returns: { 19, 23 }