Company: Google
Location: Banglore, India
Role: Graduate Program
Q.1 https://leetcode.com/problems/valid-parenthesis-string/
Q.2 A CPU can process one job at a time. Given multiple jobs with information as jobId, submissionTimestamp_ms, runtime_ms for each job where runtime_ms means time took to complete that job and submissionTimestamp_ms means time at which the job was submitted.
Return the order in which the jobs can run. Condition is that CPU always pick the job with lesser runtime_ms. That means which takes less time to execute.
Thought of sorting keeping submissionTimestamp_ms as primary and runtime_ms as secondary. Then went to priority_queue data structure.
Any approach or solution is welcome. Thanks in advance.