Two Python problems to solve

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 .

By which you mean: You have homework.

What have you done so far?

1 Like

I’m starting to work on this problem now and I need help unlocking a resolution for these 2 problems. I’m not experienced with Python and I just started a few months ago.

The problems are not Python-specific. It’s more about creating the methods to resolve them.

Sounds like you need to counter the occurences of each number by
scanning them all. Then pick the odd number based on its count. Try
writing some code to do these 2 things.