Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse Integer #30

Closed
Tracked by #100
fkdl0048 opened this issue Jul 23, 2024 · 0 comments
Closed
Tracked by #100

Reverse Integer #30

fkdl0048 opened this issue Jul 23, 2024 · 0 comments
Assignees
Labels
Milestone

Comments

@fkdl0048
Copy link
Owner

fkdl0048 commented Jul 23, 2024

class Solution {
public:
    int reverse(int x) {
        int ans = 0;
        while (x != 0){
            int digit = x % 10;
            
            if ((ans > INT_MAX / 10) || (ans < INT_MIN / 10))
                return 0;

            ans = ans * 10 + digit;
            x = x / 10;
        }

        return ans;
    }
};
@fkdl0048 fkdl0048 mentioned this issue Jul 23, 2024
7 tasks
@fkdl0048 fkdl0048 self-assigned this Jul 23, 2024
@fkdl0048 fkdl0048 added this to Todo Jul 23, 2024
@github-project-automation github-project-automation bot moved this to Todo in Todo Jul 23, 2024
@fkdl0048 fkdl0048 moved this from Todo to Two-Week Plan in Todo Jul 23, 2024
@fkdl0048 fkdl0048 added this to the LeetCode milestone Jul 23, 2024
@fkdl0048 fkdl0048 moved this from Two-Week Plan to In Progress in Todo Jul 25, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Todo Sep 27, 2024
@fkdl0048 fkdl0048 mentioned this issue Oct 15, 2024
47 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

1 participant