I was doing problems in $ leetcode$ and i found a problem , which I could not solve

Given a $ non-negative$ $ number$ $ n$ and also two $ non-negative$ $ numbers$ $ a$ and $ b$ .Consider every number $ i$ such that $ a<=i<=b$ and among those find $ maximum$ value of $ n$ &$ i$ where “&” means “$ bitwise$ $ and$ “.

I could only solve when $ a=0$ by find the most significant bit location in $ b$ and in $ n$ and comparing both and find that $ i$ should be $ b$ or let location of most significant bit be $ k$ from $ right$ then it must be $ 1111111…….1$ $ (k-1)$ times.

But when $ a$ is not zero i am struck. Can anybody help me?

P.S : I am finding the question and i will post it’s link by tomorrow.(sorry for the delay, it is due to covid-19)