File tree 5 files changed +39
-3
lines changed
5 files changed +39
-3
lines changed Original file line number Diff line number Diff line change
1
+ .DS_Store
2
+ .vscode /settings.json
3
+ .vscode /launch.json
4
+ sqltools_20201017160659_98747.log
Original file line number Diff line number Diff line change 255
255
| 174| [ Dungeon Game] ( https://leetcode.com/problems/dungeon-game/ ) | | Hard|
256
256
| 173| [ Binary Search Tree Iterator] ( https://leetcode.com/problems/binary-search-tree-iterator/ ) | | Medium|
257
257
| 172| [ Factorial Trailing Zeroes] ( https://leetcode.com/problems/factorial-trailing-zeroes/ ) | | Easy|
258
- | 171| [ Excel Sheet Column Number] ( https://leetcode.com/problems/excel-sheet-column-number/ ) | | Easy|
258
+ | 171| [ Excel Sheet Column Number] ( https://leetcode.com/problems/excel-sheet-column-number/ ) | [ Java ] ( ./algorithms/excelSheetColumnNumber/Solution.java ) | Easy|
259
259
| 170| [ Two Sum III - Data structure design] ( https://leetcode.com/problems/two-sum-iii-data-structure-design/ ) &hearts ; | | Easy|
260
260
| 169| [ Majority Element] ( https://leetcode.com/problems/majority-element/ ) | | Easy|
261
- | 168| [ Excel Sheet Column Title] ( https://leetcode.com/problems/excel-sheet-column-title/ ) | | Easy|
261
+ | 168| [ Excel Sheet Column Title] ( https://leetcode.com/problems/excel-sheet-column-title/ ) | [ Java ] ( ./algorithms/excelSheetColumnTitle/Solution.java ) | Easy|
262
262
| 167| [ Two Sum II - Input array is sorted] ( https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/ ) &hearts ; | | Medium|
263
263
| 166| [ Fraction to Recurring Decimal] ( https://leetcode.com/problems/fraction-to-recurring-decimal/ ) | | Medium|
264
264
| 165| [ Compare Version Numbers] ( https://leetcode.com/problems/compare-version-numbers/ ) | | Easy|
359
359
| 70| [ Climbing Stairs] ( https://leetcode.com/problems/climbing-stairs/ ) | [ js] ( ./algorithms/climbingStairs/climbingStairs.js ) , | Easy|
360
360
| 69| [ Sqrt(x)] ( https://leetcode.com/problems/sqrtx/ ) | | Medium|
361
361
| 68| [ Text Justification] ( https://leetcode.com/problems/text-justification/ ) | | Hard|
362
- | 67| [ Add Binary] ( https://leetcode.com/problems/add-binary/ ) | | Easy|
362
+ | 67| [ Add Binary] ( https://leetcode.com/problems/add-binary/ ) | [ java ] ( ./algorithms/addBinary/Solution.java ) | Easy|
363
363
| 66| [ Plus One] ( https://leetcode.com/problems/plus-one/ ) | | Easy|
364
364
| 65| [ Valid Number] ( https://leetcode.com/problems/valid-number/ ) | | Easy|
365
365
| 64| [ Minimum Path Sum] ( https://leetcode.com/problems/minimum-path-sum/ ) | | Medium|
Original file line number Diff line number Diff line change
1
+ public class Solution {
2
+ // 偷懒算法,如果位过长,转化会溢出
3
+ return Integer .toBinaryString (
4
+ Integer .parseInt (a , 2 ) + Integer .parseInt (b , 2 )
5
+ );
6
+ }
Original file line number Diff line number Diff line change
1
+ public class Solution {
2
+ public int titleToNumber (String s ) {
3
+ int result = 0 ;
4
+ for (int i = 0 ; i <s .length ();i ++){
5
+ int num = s .charAt (i ) - 'A' + 1 ;
6
+ result = result * 26 + num ;
7
+ }
8
+ return result ;
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ public String convertToTitle (int n ) {
3
+ // 进制算法
4
+ StringBuilder sb = new StringBuilder ();
5
+ while (n > 0 ) {
6
+ int c = n % 26 ;
7
+ if (c == 0 ){
8
+ c = 26 ;
9
+ n = n -1 ;
10
+ }
11
+ sb .insert (0 , (char ) ('A' + c - 1 ));
12
+ n /= 26 ;
13
+ }
14
+ return sb .toString ();
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments