Excel Sheet Column Title

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.
I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.
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
...
LeetCode Problem - 168
class Solution {
public String convertToTitle(int columnNumber) {
// Initialize a StringBuilder to store the resulting column title
StringBuilder sb = new StringBuilder();
// Loop until the entire column number is processed
while (columnNumber > 0) {
// Calculate the remainder when columnNumber is divided by 26
// Subtract 1 because the alphabet is 1-based (A=1, B=2, ..., Z=26)
int remainder = (columnNumber - 1) % 26;
// Convert the remainder to the corresponding alphabet character
// Add 'A' to align the remainder with the ASCII value of 'A'
sb.append((char) (remainder + 'A'));
// Update columnNumber for the next iteration by dividing it by 26
// Subtract 1 to maintain the correct alignment with the alphabet
columnNumber = (columnNumber - 1) / 26;
}
// The result is in reverse order, so reverse it before returning
return sb.reverse().toString();
}
}




