Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 6434 |

@blackshadows | 6380 |

@mb1973 | 5708 |

@Quandray | 5245 |

@akhayrutdinov | 5111 |

@saiujwal13083 | 5046 |

@sanjay05 | 3762 |

@kirtidee18 | 3707 |

@mantu_singh | 3556 |

@marius_valentin_dragoi | 3523 |

@sushant_a | 3459 |

Complete Leaderboard | |

Handle | Score |

@cfwong8 | 1221 |

@gurshehzadsingh | 1052 |

@nithinreddy3210 | 801 |

@satyamchhatrala | 740 |

@iib2019024 | 717 |

@pritsahkar2000 | 716 |

@mohanreddy8847 | 702 |

@iamchaitanyahegde | 662 |

@balwanyadav34 | 622 |

@kaurshubhkarman6671 | 620 |

@AkashLahoty | 608 |

Complete Leaderboard |

Given a number (n) and no. of digits (m) to represent the number, find if given number can be represented in given no. of digits in any base from 2 to 32.

**Example 1:**

**Input**: n = 8, m = 2
**Output:** Yes
**Explanation**: Possible in base 3 as 8 in base 3 is 22.

**Example 2:**

Input:n = 8, m = 3Output:NoExplanation: Not possible in any base.

**Your Task: **

You dont need to read input or print anything. Complete the function **baseEquiv() **which takes n and m as input parameter and returns "Yes" if its possible to represent the number else "No" without quotes..

**Expected Time Complexity:** O(logN).

**Expected Auxiliary Space:** O(1)

**Constraints:**

1 <= n <=10^{9}

1 <= m <=32

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

YesLoading...

Base Equivalence

...