title-img


Journey to the Moon

The member states of the UN are planning to send people to the moon. They want them to be from different countries. You will be given a list of pairs of astronaut ID's. Each pair is made of astronauts from the same country. Determine how many pairs of astronauts from different countries they can choose from. Function Description Complete the journeyToMoon function in the editor below. journeyToMoon has the following parameter(s): int n: the number of astronauts int astronaut[p][2

View Solution →

Array and Queries

Given an array, you are asked to perform a number of queries and divide the array into what are called, beautiful subsequences. The array A has length n. A function f(A) is defined to be a minimal possible , such that it's possible to divide array A into x beautiful subsequences. Note that each element of an array should belong to exactly one subsequence, and subsequence does not necessarily need to be consecutive. A subsequence S with length len is called beautiful if and only if: l

View Solution →