subject

There are 10 floors in a hotel (numbered from 0 to 9). on each floor there are 26 rooms, each marked with a capital letter of the english alphabet (from "a" to "z"). your task is to compute which room was booked most frequently, based on a list of room reservations. the list of reservations consists of n three-character strings. the first character of the string is "+" or "−", which describes whether the room was booked or freed. the second and third characters correspond to the number of the floor and letter of the room, respectively. for example "+4c" means that room c on the 4th floor has just been booked, and "−0g" means that room g on the 0th floor has been freed. you may assume that the list describes a correct sequence of bookings in chronological order; that is, only free rooms can be booked and only booked rooms can be freed. all rooms are initially free. note that this doesn't mean that all rooms have to be free at the end. write a function: class solution { public string solution(string[] a); } that, given an array a consisting of n strings, representing the list of bookings, returns a two-character string consisting the floor number and letter of the room that was booked the most times. it is possible that more than one room might have been booked the same, maximum number of times; in this case, return the one whose identifier is the smallest alpha-numerically. write in java. examples: given a = ["+1a", "−1a", "+3f", "−3f", "+3f", "+8x"], your function should return "3f". room 3f was booked twice, while rooms 1a and 8x were booked only once. note that rooms 3f and 8x are still booked at the end. given a = ["+1a", "+3f", "+8x", "−1a", "−3f", "−8x"], your function should return "1a". all of the rooms "1a", "3f" and "8x" were booked once. "1a" is the smallest alpha-numerically out of them. given a = ["+0a"], your function should return "0a". given a = ["+9z", "−9z", "+9z", "−9z", "+9z", "+3b"], your function should return "9z", as room 9z was booked three times. assume that: n is an integer within the range [1..600]; each element of array a is a string consisting of three characters: "+" or "−", a digit ("0"-"9"), and uppercase english letter ("a"-"z"); the sequence is correct, that is every booked room was previously free and every freed room was previously booked. in your solution, focus on correctness. the performance of your solution will not be the focus of the assessment.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
Aletter or menu command that starts an action when the user presses the designated letter and the alt key together is called what?
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a.if the manual switch s is on, then the light l is on. b.besides the manual switch, there is a motion detector, m1, which activatesthis light.c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d.the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
question
Computers and Technology, 23.06.2019 13:00
Which of the following statements is false? a. a class can directly inherit from class object. b. if the class you're inheriting from declares instance variables as private, the inherited class can access those instance variables directly. c. a class's instance variables are normally declared private to enforce good software engineering. d. it's often much more efficient to create a class by inheriting from a similar class than to create the class by writing every line of code the new class requires.
Answers: 3
question
Computers and Technology, 24.06.2019 16:30
What is the item which could be matched with a statement below? software installed on a computer that produces pop-up ads using your browser an example of social engineering malware loads itself before the os boot is complete type of spyware that tracks your keystrokes, including passwords windows key + l the practice of tricking people into giving out private information or allowing unsafe programs into the network or computer when someone who is unauthorized follows the employee through a secured entrance to a room or building a type of malware that tricks you into opening it by substituting itself for a legitimate program a computer that has been hacked, and the hacker is using the computer to run repetitive software in the background without the user's knowledge an infestation designed to copy itself repeatedly to memory, on drive space, or on a network
Answers: 1
You know the right answer?
There are 10 floors in a hotel (numbered from 0 to 9). on each floor there are 26 rooms, each marked...
Questions
question
Mathematics, 27.08.2020 19:01
question
Mathematics, 27.08.2020 19:01
question
English, 27.08.2020 19:01
Questions on the website: 13722363