In the end, it is said that p with log n can be used to place queen. This statement is not clear. Kindly help.
Ending was'nt clear
1:16:34 is the timestamp
hi @sukritbansal01 p will be a number with only 1 set bit.
The problem is, how to find which bit is the set bit in that number, without iterating through all the bits?
In that case, you can simply do log(p)
to find which bit was the set bit. By ānā sir was referring to any arbitrary number n which has only 1 set bit.
This formula works because any number with only 1 set bit will be a power of 2 only, so taking log of that number with base 2 will tell you the position of the set bit.