Josephus Problem Algorithm using Bit Manipulation | Bit Manipulation Interview Questions

Опубликовано: 31 Август 2020
на канале: Pepcoding
30,427
709

Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.

NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we explain question Josephus Problem and discuss the algorithm to solve this problem using bit manipulation. In this problem,

1. You are given an integer N which represents the total number of soldiers standing in a circle having position marked from 1 to N.
2. A cruel king wants to execute them but in a different way.
3. He starts executing soldiers from 1st position and proceeds around the circle in clockwise direction.
4. In each step, every second soldier is executed.
5. The elimination proceeds around the circle (which is becoming smaller and smaller as the executed soldiers are removed), until only the last soldier remains, who is given freedom.
6. You have to find the position of that lucky soldier.


Click here to submit this question: https://www.pepcoding.com/resources/d...

For a better experience and more exercises, VISIT:
#josephus #bitmanipulation #competitiveprogramming


Have a look at our result:
Follow us on our FB page:   / pepcoding  
Follow us on Instagram:   / pepcoding  
Follow us on LinkedIn:   / pepcoding-education  
Join us on Telegram: https://t.me/joinchat/UVTjJE83a-zFnPB


На этой странице сайта вы можете посмотреть видео онлайн Josephus Problem Algorithm using Bit Manipulation | Bit Manipulation Interview Questions длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Pepcoding 31 Август 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 30,427 раз и оно понравилось 709 зрителям. Приятного просмотра!