A profile page shows a row of achievement badges. Each badge is a lowercase letter in badges, and badges with the same letter look identical.
Write badgeArrangements(badges) that returns how many visibly different orders of the row exist, modulo 1000000007.
Input: badges = "aab" Output: 3
aab, aba, and baa. Swapping the two as looks the same.
Input: badges = "abc" Output: 6
All letters differ, so all 3! = 6 orders look different.
1 <= badges.length <= 2 * 10^5badges contains lowercase letters only.Run 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 #652 Distinct Badge Arrangements. 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.