lundi 6 septembre 2021

How to get power of x which is smaller or equal than a given number n?

I have problem where there are two numbers given x and n , the task is to find a power of x which is just equal or smaller than n . I know i can do this by starting a loop but it seems not so efficient solution, i want to know any solution which is in o(1) or something efficient.

Aucun commentaire:

Enregistrer un commentaire