Unique decimals in binary strings

Правка en2, от ankurrathinsit, 2021-07-10 16:06:41

So as the title says, given a binary string of length n (1<=n<=10^5) , find the number of unique decimals that can be obtained from subsequences of the binary string:

Example : 101

0=0

1=1

01 (same as 1) so rejected

10= 2

101= 5

11= 3

So, number of unique decimals are 5. I can only think of recursive solution.

How to approach ?

Btw it was asked today in Google hiring contest.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский ankurrathinsit 2021-07-10 16:56:43 14 Tiny change: ' approach ?\n\nBtw ' -> ' approach this question ?\n\nBtw '
en2 Английский ankurrathinsit 2021-07-10 16:06:41 4 Tiny change: 'solution. How to app' -> 'solution. \n\nHow to app'
en1 Английский ankurrathinsit 2021-07-10 16:02:00 441 Initial revision (published)