just one-line time solution


  • 0
    H

    just one line-time

    boolean isDetermine(int palidrome) {

        String covertStr = String.valueOf(palidrome);
    
        for (int i = 0; i < covertStr.length(); i++) {
    
            String one = Character.toString(covertStr.charAt(i));
            String two = Character.toString(covertStr.charAt(covertStr.length() - (i + 1)));
            if (!one.equals(two)) {
                return false;
            }
        }
        return true;
    }

Log in to reply
 

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