Palindrome check · ตรวจสอบพาลินโดรม
Palindrome check
A palindrome reads the same forwards and backwards. Return true if s does, ignoring case and spaces, so Race car counts. Clean the string first (toLowerCase, remove spaces), then compare characters moving inward from both ends.
ตรวจสอบ Palindrome
Palindrome อ่านเหมือนกันทั้งไปและมา คืนค่า true หาก s ทำ, ignoring case และช่องว่าง, ดังนั้น Race car นับ Clean string ก่อน (toLowerCase, ลบช่องว่าง), แล้วเปรียบเทียบตัวอักษร moving inward จากทั้งสองด้าน
Complete isPalindrome(String s) so it returns true when s reads the same forwards and backwards, ignoring case and spaces. · เติม isPalindrome(String s) ให้มันกลับค่า true เมื่อ s อ่านไปข้างหน้าและย้อนหลังเหมือนกัน โดยไม่สนใจตัวพิมพ์เล็ก/ใหญ่และช่องว่าง
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่