A browser shows pinned tabs at the left of the tab bar. tabs lists the open tabs in their current order, and pinned lists tab names in the order the user pinned them (it may mention tabs that are no longer open).
Write arrangeTabs(tabs, pinned) that returns the tabs with every open pinned tab first, in the order of pinned, followed by all the other tabs in their current order.
Input: tabs = ["news","mail","docs","chat"], pinned = ["chat","mail"] Output: ["chat","mail","news","docs"]
Pinned tabs go first in pinned order; news and docs keep their order.
Input: tabs = ["a","b"], pinned = ["z"] Output: ["a","b"]
z is not open, so nothing moves.
0 <= tabs.length, pinned.length <= 10000tabs are distinct; names in pinned are distinct.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 #223 Pinned Tabs First. 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.