6 kyu

Unique Strings

278 of 463aditya7iyengar

Description:

Given a string that contains only letters, you have to find out the number of unique strings (including the string itself) that can be produced by re-arranging the letters of the string. Strings are case insensitive.

HINT: Generating all the unique strings and calling length on that isn't a great solution for this problem. It can be done a lot faster...

Examples

uniqcount("AB") = 2      # "AB", "BA"
uniqcount("ABC") = 6     # "ABC", "ACB", "BAC", "BCA", "CAB", "CBA"
uniqcount("ABA") = 3     # "AAB", "ABA", "BAA"
uniqcount("ABBb") = 4    # "ABBB", "BABB", "BBAB", "BBBA"
uniqcount("AbcD") = 24   # "ABCD", etc.
uniqCount("AB") = 2n      // "AB", "BA"
uniqCount("ABC") = 6n     // "ABC", "ACB", "BAC", "BCA", "CAB", "CBA"
uniqCount("ABA") = 3n     // "AAB", "ABA", "BAA"
uniqCount("ABBb") = 4n    // "ABBB", "BABB", "BBAB", "BBBA"
uniqCount("AbcD") = 24n   // "ABCD", etc.

// Note that you should return a BigInt, not a Number
Algorithms

Stats:

CreatedJan 4, 2017
PublishedJan 4, 2017
Warriors Trained1568
Total Skips56
Total Code Submissions4159
Total Times Completed463
Elixir Completions35
Ruby Completions65
Python Completions278
Haskell Completions18
Rust Completions24
D Completions5
Go Completions15
JavaScript Completions76
Total Stars60
% of votes with a positive feedback rating92% of 159
Total "Very Satisfied" Votes142
Total "Somewhat Satisfied" Votes9
Total "Not Satisfied" Votes8
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • aditya7iyengar Avatar
  • raulbc777 Avatar
  • anter69 Avatar
  • kazk Avatar
  • JohanWiltink Avatar
  • maipatana Avatar
  • hobovsky Avatar
  • akar-0 Avatar
  • Kacarott Avatar
Ad