Can You Count the Bit Strings?

Company: Snowflake_28july

Difficulty: medium

Problem Statement

A bit string is a string made up only of the characters 0 and 1 . Starting from a bit string s , a super bit string of s is any bit string that can be obtained by flipping zero or more of the 0 characters of s into 1 . Characters that are already 1 are never changed, and the length never changes. In particular, s is always a super bit string of itself. You are given an integer n and a list of k non-negative integers. Convert every integer into its binary representation padded with leading zeros to exactly n characters. For each of the k resulting bit strings, form the set of all of its super bit strings, and report how many distinct bit strings appear in the union of those k sets. Input Format The first line contains a single integer n , the length of every bit string. The second line contains a single integer k , the number of integers. Each of the next k lines contains a single integer bitStrings[i] . Output Format Print a single integer: the size of the union of the super bit string