Python Forum
Two Python problems to solve - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Two Python problems to solve (/thread-41764.html)



Two Python problems to solve - djzsp - Mar-16-2024

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 .


RE: Two Python problems to solve - deanhystad - Mar-17-2024

Please post the work you have done toward solving these problems.