Leetcode 171 JAVA

Source: Internet
Author: User

public class Solution {private static Scanner sc = null;     private static final int RADIX = 26; Enum Alphabet {A (1), B (2), C (3), D (4), E (5), F (6), G (7), H (8), I (9), J (Ten), K (one), L (N), M (All), P (1         6), Q (+), R (+), S (+), T (+), U (+), V (+), W (All), X (s), Y (+), Z (26);         private int value;        Private Alphabet (int value) {this.value = value;        } public int GetValue () {return value;        } public void SetValue (int value) {this.value = value; } public int Getvaluebyname (String c) {for (Alphabet alp:Alphabet.values ()) {if (ALP                . Name (). Equals (c)) {return alp.value;        }} return 0;        }} public int titletonumber (String str) {int result = 0;        int alplength = Str.length ()-1; for (int i = 0; I <= alplength; i++) {result = result + Alphabet. ValueOf (String.valueof (Str.charat (alplength-i)). Value * (int) Math.pow (RADIX, i);    } return result; }}

Leetcode 171 JAVA

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.