package com.fishercoder.solutions;

/**
 * 170. Two Sum III - Data structure design
 *
 * Given a column title as appear in an Excel sheet, return its corresponding column number.

 For example:

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

 */
public class _171 {

  public static class Solution1 {
    public int titleToNumber(String s) {
      char[] c = s.toCharArray();
      int result = 0;
      for (int i = s.length() - 1; i >= 0; i--) {
        result +=
            (c[i] - 64) * ((int) Math.pow(26, s.length() - i - 1));//The ASCII value of A is 65
      }
      return result;
    }
  }
}

@@ -33,231 +33,8 @@
 s;%0A%0A
-/**%0A * 170. Two Sum III - Data structure design%0A *%0A * Given a column title as appear in an Excel sheet, return its corresponding column number.%0A%0A For example:%0A%0A A -%3E 1%0A B -%3E 2%0A C -%3E 3%0A ...%0A Z -%3E 26%0A AA -%3E 27%0A AB -%3E 28%0A%0A */%0A
 publ
@@ -50,16 +50,18 @@
 _171 %7B%0A%0A
+  
   public
@@ -86,16 +86,20 @@
 tion1 %7B%0A
+    
     publ
@@ -137,16 +137,22 @@
 %7B%0A      
+   
+   
 char%5B%5D c
@@ -171,16 +171,22 @@
 rray();%0A
+      
       in
@@ -199,16 +199,22 @@
 lt = 0;%0A
+      
       fo
@@ -263,16 +263,24 @@
         
+   
+     
 result +
@@ -281,16 +281,28 @@
 sult +=%0A
+            
         
@@ -395,18 +395,30 @@
 5%0A      
-%7D%0A
+      %7D%0A      
       re
@@ -434,16 +434,22 @@
 lt;%0A    
-%7D%0A
+    %7D%0A  
   %7D%0A%7D%0A

refactor 171