Uber Internship Question — Help Needed

Правка en1, от kstheking, 2020-08-08 10:46:06

We had this question on our Internship test, and I couldn't figure out how to do it, help please

Given a string s and a number p find number of unique special strings that can be formed using the given string
A special string is a permutation of string made from a subsequence of s, whose sum of ASCII values of its characters is divisible by p
Example: s = "ab", p = "2"
answer = 1
all possible unique strings = "a","b","ab", "ba"
respective sums = 97, 98, 195, 195
reason: since there is only one number (98) which is divisible by 2 so total answer = 1
Constraints: |s| <= 20 and 1 <= p <= 20
print the answer modulo 1000000007

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский kstheking 2020-08-08 10:47:08 3 Tiny change: '<= p <= 20 \nprint' -> '<= p <= 200 \nprint'
en1 Английский kstheking 2020-08-08 10:46:06 699 Initial revision (published)