diff --git a/c++/Leetcode_question/Reverse_Integer.cpp b/c++/Leetcode_question/Reverse_Integer.cpp new file mode 100644 index 00000000..3ad5d410 --- /dev/null +++ b/c++/Leetcode_question/Reverse_Integer.cpp @@ -0,0 +1,17 @@ +class Solution { +public: + int reverse(int x) { + int ans =0; + while(x !=0){ + int digit = x%10; + + if((ans >INT_MAX /10) || (ans