• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
October 04, 2023 |2.0K Views
PROBLEM OF THE DAY: 03/10/2023 | Column name from a given column number
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Siddhartha Hazra. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Strings but will also help you build up problem-solving skills.

In this problem, we are given, a positive integer, return its corresponding column title as appear in an Excel sheet.
Excel columns has a pattern like A, B, C, … ,Z, AA, AB, AC,…. ,AZ, BA, BB, … ZZ, AAA, AAB ….. etc. In other words, column 1 is named as “A”, column 2 as “B”, column 27 as “AA” and so on.

Example :

Input:
N = 28
Output: AB

Explanation: 1 to 26 are A to Z. Then, 27 is AA and 28 = AB.

Give the problem a try before going through the video. All the best!!!

Problem Link: https://practice.geeksforgeeks.org/problems/column-name-from-a-given-column-number4244/1