From 12ab48bf5d25acc38e4531b1ab62a471b4351df8 Mon Sep 17 00:00:00 2001 From: Aman Kumar <61074175+amanjaiswa@users.noreply.github.com> Date: Thu, 24 Oct 2024 18:38:32 +0530 Subject: [PATCH] Create Reverse_Integer.cpp --- c++/Leetcode_question/Reverse_Integer.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 c++/Leetcode_question/Reverse_Integer.cpp 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