The out for loop runs n times and the while loop for each i would run log of i base (n) times wouldn’t it??
So why is the complexity O(n)??
Why is the time complexity of naive approach O(N)?
complexity should be O(n)
because inner while loop will executed almost constant no of time
it will not of the order n
even for large value of n it will executed very less no of time
so final complexity will be of the order n hence O(n)
if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved 
inner while loop worst case time is logN so can it be ignored ?
inner while loop is not taking logN
because N is also decreasing
its taking greater than logN ,something like (logN + something ) right ?