An admin panel compares two roles. Each role's permissions are listed in a and b, possibly with repeats.
Write sharedPermissions(a, b) that returns every permission that appears in both lists, each once, sorted in normal string order.
Input: a = ["read","write","delete"], b = ["write","admin","read"] Output: ["read","write"]
read and write are in both roles.
Input: a = ["view"], b = ["edit"] Output: []
The roles share nothing.
0 <= a.length, b.length <= 10^5Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #22 Shared Permissions. 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.