Python Dasar-dasarMudah

nomor palindrom

Panduan lengkap dan implementasi Python untuk soal 'Nomor Palindrom'.

Pernyataan Masalah

Mudah

Tulis fungsi is_palindrome(n) yang mengambil bilangan bulat non-negatif n dan mengembalikan True jika n membaca maju dan mundur yang sama, atau False sebaliknya.

Kendala
  • 0 <= n <= 10^9

Contoh

Example 1
Input
n = 121
Output
True
Explanation

121 reversed is 121, which is the same, so it is a palindrome.

Example 2
Input
n = 123
Output
False
Explanation

123 reversed is 321, which is different, so it is not a palindrome.

Example 3
Input
n = 0
Output
True
Explanation

0 reversed is 0, so it is a palindrome.

Need a Hint?
Pertimbangkan untuk menggunakan struktur data khusus Dasar-Dasar seperti kumpulan atau tumpukan.
Edge Cases to Watch
  • Struktur masukan kosong
  • Masukan elemen tunggal
  • Batasan angka yang besar

Siap Memecahkannya?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

Buka di Editor
Found this breakdown helpful?

PyRun is built and maintained by an independent solo developer. If this helped your interview prep, consider buying a coffee!

Buy me a coffee

Sumber Daya Python yang Direkomendasikan

Perluas pengetahuan Anda dengan tutorial interaktif terkait, lembar contekan, dan perbandingan kode.