Reverse Integer | LeetCode problem 7

preview_player
Показать описание
Reverse Integer
Leetcode problem number 5
Solution in JAVA

JAVA interview programming playlist:

#java #interviewquestions #leetcode
Рекомендации по теме
Комментарии
Автор

Wow! You handled overflow condition greatly, Thank You!

gautamhelange
Автор

Hello.. Thankyou for this video.
Can you explain please why can't we use overflow condition like
if (rev*10 > Integer.MAX_VALUE || rev*10 < Integer.MIN_VALUE)

mayanksinghal
Автор

Great explanation, but it would be great if you use dark theme on leetcode

faizuddin
Автор

Amazing...keep up the good work. I like the way you break down the problem on white board but please slow it down a little bit when you code.

oorja
Автор

If number is 6804 that is containing zero and we want reverse number 4086 then what we do? according to your solution it gives 486

mathsworldbysuraj
Автор

Why you are dividing by 10 to check overflow condition

sanjaykumarpandey
Автор

Hello mam if rev>max or min we need to get output as 0 then y it is returning garbage value .Leet code is not accepting this code...

KRajesh-ejdy
Автор

import java.util.*;
class Main {
public static void main (String [] args){
int nums=4567;
;
}
public static int reverseInt(int n) {
int rev=0;
while(n>0){
int Lastdigit=n%10;
n=n/10;
rev=rev*10+Lastdigit;
}
return rev;
}
}

SandraSaade