Код:
class Solution {
public:
bool isPalindrome(int x) {
int out = 0;
int normal = x;
while(normal > 0){
out *= 10;
out += normal % 10;
normal /= 10;
}
if(out == x){
return true;
} else {
return false;
}
}
};
Ошибка:
Line 7: Char 17: runtime error: signed integer overflow: 998765432 * 10 cannot be represented in type 'int' (solution.cpp)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior prog_joined.cpp:16:17
Подробнее здесь: https://stackoverflow.com/questions/798 ... type-int-w
Мобильная версия