题解 | #回文字符串#

回文字符串

https://www.nowcoder.com/practice/84424799af474ba093b06c29a1f12dfb?tpId=271&tqId=39570&rp=1&ru=/exam/oj&qru=/exam/oj&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3DJS%25E7%25AF%2587%26topicId%3D271&difficulty=undefined&judgeStatus=undefined&tags=&title=

        const _isPalindrome = string => {
            // 补全代码
            let left = 0;
            let right = string.length-1;
            while(left < right){
                left++;
                right--;
                return string[left] === string[right];
            }
        }

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务