# 【LeetCode】007 Reverse Interger

``` 1 class Solution {
2 public:
3     int reverse(int x) {
4         int len, flag = 1, i = 0;
5         long long ans = 0;
6         string s = to_string(x);
7
8         len = s.size();
9         len--;
10         if(s[i] == ‘-‘)
11         {
12             flag = -1;
13             i++;
14         }
15         // else if(s[i] == ‘+‘) i++;
16
17         while(len >= i)
18         {
19             ans *= 10;
20             ans += s[len--]-‘0‘;
21         }
22         ans *= flag;
23         //cout << ans << endl;
24         // 返回值根据预设的函数类型自动变，Longlong也会自动按int溢出处理
25         if(ans > INT_MAX || ans < INT_MIN) return 0;
26         return ans;
27     }
28 };```

## 【Leetcode】Evaluate Reverse Polish Notation JAVA

一.问题描述 Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another expression. Some examples: ["2", "1", "+", "3", "*&

## 【Leetcode】 #7 Reverse Integer

Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 测试用例: 123………………321 -123………………-321 1200………………21 45134543545…………0(overflow) 2147483646………………0(虽然它小于最大值2147483647,但是调转过来之后溢出!) 最后两个陷阱是不容易发现的. int类型的最大值是2147483647

## 【leetcode】92. Reverse Linked List II

Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note:Given m, n satisfy the following condition:1 ≤ m ≤ n ≤ lengt