mirror of
https://github.com/lWolvesl/leetcode.git
synced 2026-01-12 18:08:38 +08:00
routine
This commit is contained in:
10
25/12/comp/21q1.cpp
Normal file
10
25/12/comp/21q1.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <string>
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
int mirrorDistance(int n) {
|
||||
std::string s = std::to_string(n);
|
||||
std::reverse(s.begin(),s.end());
|
||||
return std::abs(n - std::stoi(s));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user