GOOGLE Coding Question – Solved

2 Live
1. Unique Decimal Count Given a binary string consisting only of '0's and '1's, determine how many unique decimal values can be represented by all possible non-empty subsequences of the string. Notes: - The binary string may include leading zeros. - A subsequence is formed by deleting some characters (possibly none) without changing the order of the remaining characters. Example: "ace" is a subsequence of "abcde", but "aec" is not. Example: binary = "010" - Distinct subsequences of the string are 0, 1, 01, 010, and 10. - Their corresponding decimal representations are 0, 1, 1, 2, and 2. - Distinct decimal numbers are 0, 1, and 2. - The unique decimals count is 3. Return 3. Function Description:

Asked in: GOOGLE

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| Given an n x m grid, where rows are numbered from 7 to n and columns from 1 to … |
| There are 'N' coders standing in a line, where i denotes the ith position of a … |
| A birthday party was attended by N number of kids, and each kid was given a uni… |
| Given a matrix of size m * n, where m denotes the number of rows (starting with… |
| A traveler is traveling from the city of Zeta to Omega. He starts with X amount… |
| As an operations engineer at Amazon, you are responsible for organizing the dis… |