https://ide.codingblocks.com/s/53278 test case fails what’s wrong in my code kindly debug …
Count subsequence test fail
Mention problem link.
In case in question you just want the count number of sub sequences DONOT use pow() function, as it has a small range of ‘int’. use bit shift to calculate ( or binary exponentiation or fast approach ).
eg: 2^4 =1<<4 (using bit shift).
Hey Neeraj, your approach is not correct, this solution will work only for the cases in which all the characters of the string are different. So, think a lil bit more and use some Dynamic Programming to solve this problem.
You can check you code for this case
input:
ADD
your code’s output:
8
but the expected output is:
6
Hey Sanjeet, Please read carefully i have NOT suggested the solution of question, as i am not aware of the question, i have asked for the link in my previous comments. After seeing just the coding i have suggested possible errors in it. Pow function is one of the common errors in large range, it is not very much useful, i have suggested another way.
Hey Tushar, by mistake I have mentioned your name actually I replied to Neeraj. 