GOOGLE Coding Question – Solved

8 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

| You are given a board of size M Γ— N where each cell can be either empty ('O') o… |
| Undirected Coloured Graph Shortest Path You are given an undirected weight… |
| Village Voyage A computer game "Village Voyage" has N villages (labeled 1 to… |
| Academic Decathlon Students are being selected for an academic decathlon tea… |
| Sum of Arrays Given two arrays each of length n, arr1 and arr2, in one opera… |
| Count Swaps During Custom Sorting Analyze the efficiency of the following so… |