AND Product
Consider two non-negative long integers, and , where . The bitwise AND of all long integers in the inclusive range between and can be expressed as , where is the bitwise AND operator. Given pairs of long integers, and , compute and print the bitwise AND of all natural numbers in the inclusive range between and . For example, if and , the calculation is . Function Description Complete the andProduct in the editor below. It should return the computed value as an integer. and
View Solution →Winning Lottery Ticket
The SuperBowl Lottery is about to commence, and there are several lottery tickets being sold, and each ticket is identified with a ticket ID. In one of the many winning scenarios in the Superbowl lottery, a winning pair of tickets is: Concatenation of the two ticket IDs in the pair, in any order, contains each digit from to at least once. For example, if there are distinct tickets with ticket ID and , is a winning pair. NOTE: The ticket IDs can be concantenated in any order. Digits i
View Solution →Xoring Ninja
An XOR operation on a list is defined here as the xor () of all its elements (e.g.: ). The of set is defined here as the sum of the s of all non-empty subsets of known as . The set can be expressed as: For example: Given set The set of possible non-empty subsets is: The of these non-empty subsets is then calculated as follows: = Given a list of space-separated integers, determine and print . For example, . There are three possible subsets, . The XOR of , of and of
View Solution →Cipher
Jack and Daniel are friends. They want to encrypt their conversations so that they can save themselves from interception by a detective agency so they invent a new cipher. Every message is encoded to its binary representation. Then it is written down times, shifted by bits. Each of the columns is XORed together to get the final encoded string. If and it looks like so: 1001011 shift 0 01001011 shift 1 001001011 shift 2 0001001011 shift 3 ---------- 1110101001 <- XORe
View Solution →XOR Matrix
Consider a zero-indexed matrix with rows and columns, where each row is filled gradually. Given the first row of the matrix, you can generate the elements in the subsequent rows using the following formula: Each row is generated one by one, from the second row through the last row. Given the first row of the matrix, find and print the elements of the last row as a single line of space-separated integers. Note: The operator denotes bitwise XOR. Input Format The first line contains
View Solution →