File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 118
118
152|[ Maximum Product Subarray] ( ./0152-maximum-product-subarray.js ) |Medium|
119
119
160|[ Intersection of Two Linked Lists] ( ./0160-intersection-of-two-linked-lists.js ) |Medium|
120
120
167|[ Two Sum II - Input Array Is Sorted] ( ./0167-two-sum-ii-input-array-is-sorted.js ) |Easy|
121
+ 168|[ Excel Sheet Column Title] ( ./0168-excel-sheet-column-title.js ) |Easy|
121
122
169|[ Majority Element] ( ./0169-majority-element.js ) |Easy|
122
123
179|[ Largest Number] ( ./0179-largest-number.js ) |Medium|
123
124
189|[ Rotate Array] ( ./0189-rotate-array.js ) |Medium|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 168. Excel Sheet Column Title
3
+ * https://leetcode.com/problems/excel-sheet-column-title/
4
+ * Difficulty: Easy
5
+ *
6
+ * Given an integer columnNumber, return its corresponding column
7
+ * title as it appears in an Excel sheet.
8
+ */
9
+
10
+ /**
11
+ * @param {number } columnNumber
12
+ * @return {string }
13
+ */
14
+ var convertToTitle = function ( columnNumber ) {
15
+ const n = columnNumber - 1 ;
16
+ return n >= 0 && n < 26
17
+ ? String . fromCharCode ( 65 + n )
18
+ : convertToTitle ( parseInt ( n / 26 ) ) + convertToTitle ( ( n % 26 ) + 1 ) ;
19
+ } ;
You can’t perform that action at this time.
0 commit comments