Base 58 Conversion Problem Statement

You are given a decimal number 'N'. Your task is to convert this number into a base 58 representation.

The Base58 alphabet is defined by the following characters: “123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz”

Conversion Example:

Base 10 | Base 58
0 | 1
1 | 2
10 | A
20 | L
30 | W
53 | u

Input:

The first line of the input contains an integer ‘T’ representing the number of test cases.

The first and the only line of each test case contains an integer N.

Output:

For each test case, output a single line containing the Base 58 representation of the number N.
The output for each test case should be on a new line.
Example:
Input:
2
5
1000

Output:
6
if

Constraints:

  • 1 ≤ T ≤ 50
  • 0 ≤ N ≤ 104
  • Time limit: 1 sec.

Note:

You do not need to handle input or output operations; the implementation function will manage these.
Be the first one to answer
Add answer anonymously...
Facebook Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter