【Lintcode】23. Is alphanumeric

题目地址:

https://www.lintcode.com/problem/is-alphanumeric/description

判断一个字符是否是数字或者字母。

代码如下:

public class Solution {
    /**
     * @param c: A character.
     * @return: The character is alphanumeric or not.
     */
    public boolean isAlphanumeric(char c) {
        // write your code here
        return Character.isDigit(c) || Character.isLetter(c);
    }
}

时空复杂度 O ( 1 ) O(1) O(1)。

上一篇:【Lintcode】305. Longest Increasing Path in a Matrix


下一篇:LintCode领扣算法问题答案:223. 回文链表