תיאור השאלה
Given an integer x, return true if x is a palindrome, and false otherwise.
איך פותרים?
Reverse the digits numerically and compare with the original value.
פתרון קוד
JavaScript
Python
function isPalindrome(x) {
if (x < 0) return false;
let original = x;
let reversed = 0;
while (x > 0) {
reversed = reversed * 10 + (x % 10);
x = Math.floor(x / 10);
}
return reversed === original;
}הסבר וידאו כיצד לפתור את השאלה

לעבור את ראיון העבודה הבא שלך בהצלחה
קורס דיגיטלי מקיף עם +25 שיעורים מעשיים, כשעתיים של וידאו, וליווי של מראיין בכיר.