Mar-16-2024, 12:55 AM
Solving 2 problems
Goodnight.
I have two problems and I would like help from my colleagues to resolve them. Are they:
Problem 1) Suppose someone presents you with a bag containing an odd number of numbers, be it 2m+1, with m > 300,000,000.
Also, be told that the numbers appear in pairs, with the exception of one of them. For example, inside the bag, S, there could be S = [[4, 6, 8, 6, 4]]. Find out what this different number is. Explain how much time and memory your algorithm takes to solve this problem.
Problem 2) Suppose you are asked to find the ranking of an integer m in the sequence L from 0 to n, be it r(n) in which chains with at least two consecutive 1's are prohibited. For example,
r(000) = 1; r(001) = 2, r(010) = 3, r(011) = 3 and r(100) = 4. Note that r(011) contains a prohibition and therefore, r(010) = r(011) = 3 .
Goodnight.
I have two problems and I would like help from my colleagues to resolve them. Are they:
Problem 1) Suppose someone presents you with a bag containing an odd number of numbers, be it 2m+1, with m > 300,000,000.
Also, be told that the numbers appear in pairs, with the exception of one of them. For example, inside the bag, S, there could be S = [[4, 6, 8, 6, 4]]. Find out what this different number is. Explain how much time and memory your algorithm takes to solve this problem.
Problem 2) Suppose you are asked to find the ranking of an integer m in the sequence L from 0 to n, be it r(n) in which chains with at least two consecutive 1's are prohibited. For example,
r(000) = 1; r(001) = 2, r(010) = 3, r(011) = 3 and r(100) = 4. Note that r(011) contains a prohibition and therefore, r(010) = r(011) = 3 .