Old but gold
Let's discuss a programming task. You have a bunch of numeric pairs like 5, 5, 7, 7, 2, 2 and one unique number, like 13. You mix everything into one array and shuffle it. Now you have something like [7, 2, 13, 5, 2, 7, 5]. Let n be the number of elements and let it be huge, like 100000000. Numbers are 32- or 64-bit wide. The task is to find the unique number. In our case it would be 13.
Feel free to share in comments time and memory complexities of your approach to this problem. It would be like T=O(...); M=O(...)
I think it would be fun to collect options for a few days and then compare algorithms.
Let's discuss a programming task. You have a bunch of numeric pairs like 5, 5, 7, 7, 2, 2 and one unique number, like 13. You mix everything into one array and shuffle it. Now you have something like [7, 2, 13, 5, 2, 7, 5]. Let n be the number of elements and let it be huge, like 100000000. Numbers are 32- or 64-bit wide. The task is to find the unique number. In our case it would be 13.
Feel free to share in comments time and memory complexities of your approach to this problem. It would be like T=O(...); M=O(...)
I think it would be fun to collect options for a few days and then compare algorithms.
How to vibecode Chizhik-Pyzchic app
In the alternative channel there is step-by-step instruction how to create a small, but fully functional web application. Post language is Russian.
In the alternative channel there is step-by-step instruction how to create a small, but fully functional web application. Post language is Russian.
Telegram
Alina_Yerevan_frontend
Как навайбкодить Чижика-Пыжика
Мы живём в интересное время. Все привыкли, что программисты - технари. Большие языковые модели делают программистом всякого, кто может хорошо и чётко выражать свои мысли устно или письменно. То есть теперь гуманитарии - программисты.…
Мы живём в интересное время. Все привыкли, что программисты - технари. Большие языковые модели делают программистом всякого, кто может хорошо и чётко выражать свои мысли устно или письменно. То есть теперь гуманитарии - программисты.…
❤1👍1
Old but gold
There seems to be two different problems. But really, it's the same problem.
1. Find the repeating and non-repeating parts of the decimal expansion of 1/n.
1/3 = 0.(3)
1/6 = 0.1(6)
2. For a singly linked list, check whether it contains a cycle.
Share your thoughts and ideas in the comments. Use the “spoiler” feature wisely. I’ll publish the canonical approach in 3 days, if needed.
There seems to be two different problems. But really, it's the same problem.
1. Find the repeating and non-repeating parts of the decimal expansion of 1/n.
1/3 = 0.(3)
1/6 = 0.1(6)
2. For a singly linked list, check whether it contains a cycle.
Share your thoughts and ideas in the comments. Use the “spoiler” feature wisely. I’ll publish the canonical approach in 3 days, if needed.