Excel Sheet Column Title LeetCode Solution

Problem – Excel Sheet Column Title LeetCode Solution

Given an integer columnNumber, return its corresponding column title as it appears in an Excel sheet.

For example:

A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28 
...

Example 1:

Input: columnNumber = 1
Output: "A"

Example 2:

Input: columnNumber = 28
Output: "AB"

Example 3:

Input: columnNumber = 701
Output: "ZY"

Constraints:

  • 1 <= columnNumber <= 231 - 1

Excel Sheet Column Title LeetCode Solution in Java

return n == 0 ? "" : convertToTitle(--n / 26) + (char)('A' + (n % 26));

Excel Sheet Column Title LeetCode Solution in C++

return n == 0 ? "" : convertToTitle((n - 1) / 26) + (char) ((n - 1) % 26 + 'A');

Excel Sheet Column Title LeetCode Solution in Python

return "" if num == 0 else self.convertToTitle((num - 1) / 26) + chr((num - 1) % 26 + ord('A'))
Excel Sheet Column Title LeetCode Solution Review:

In our experience, we suggest you solve this Excel Sheet Column Title LeetCode Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Excel Sheet Column Title LeetCode Solution

Find on Leetcode

Conclusion:

I hope this Excel Sheet Column Title LeetCode Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published.