Given two integer a and b, find whether their product (a x b) exceed the signed 64 bit integer or not. If it exceed print Yes else print No.
Input : a = 100, b = 200 Output : No Input : a = 10000000000, b = -10000000000 Output : Yes
- If either of the number is 0, then it will never exceed the range.
- Else if the product of the two divided by one equals the other, then also it will be in range.
- In any other case overflow will occur.
Time complexity : O(1)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Heap overflow and Stack overflow
- How to avoid overflow in modular multiplication?
- Reverse digits of an integer with overflow handled
- Program to check if tank will overflow, underflow or filled in given time
- Buffer Overflow Attack with Example
- Compute average of two numbers without overflow
- Minimum decrements to make integer A divisible by integer B
- Digital Root (repeated digital sum) of square of an integer using Digital root of the given integer
- Multiply two integers without using multiplication, division and bitwise operators, and no loops
- Write you own Power without using multiplication(*) and division(/) operators
- Count divisors of array multiplication
- Program to print multiplication table of a number
- Exponential Squaring (Fast Modulo Multiplication)
- Multiplication of two complex numbers given as strings
- Why only subtraction of addresses allowed and not division/addition/multiplication
- Booth’s Multiplication Algorithm
- Divide two integers without using multiplication, division and mod operator | Set2
- Sum of multiplication of triplet of divisors of a number
- Right most non-zero digit in multiplication of array elements
- Multiplication on Array : Range update query in O(1)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.