MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / Solution

Class Solution

LeetCode_problems/Reverse Integer/solution.cpp:66–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64*/
65
66class Solution {
67public:
68 int reverse(int x) {
69 long long int reversed = 0;
70
71 while (x != 0) {
72 reversed *= 10;
73 reversed += (x % 10);
74 x /= 10;
75 }
76
77 if (reversed > INT_MAX || reversed < INT_MIN) return 0;
78 return reversed;
79 }
80};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected