One line Java 8 version


  • 0
    U
            return IntStream.range(0, s.length()).reduce(0, (result, i) -> result * 26 + (s.charAt(i) - 'A' + 1));
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.