A support inbox labels each ticket with a severity: "high", "medium", or "low". The triage view must show every "high" ticket first, then "medium", then "low".
Write orderBySeverity(tickets) that rearranges the array of labels in place in one pass, with O(1) extra memory and without calling sort. The tests check tickets after your function runs.
Input: tickets = ["low","high","medium","high"] Output: ["high","high","medium","low"]
Both high tickets come first, then medium, then low.
Input: tickets = ["medium","low"] Output: ["medium","low"]
Already in order.
0 <= tickets.length <= 100000"high", "medium", or "low".Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #121 Order Tickets by Severity. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.