Given two ladders of height h1 and h2. The task is to find the maximum height that can’t be reached using any possible combination by the two ladders. If it is possible to reach all the heights then print 0.
Input: H1 = 2, H2 = 11
We cannot reach heights 1, 3, 5, 7 and 9.
So, the maximum possible height is 9.
Input: H1 = 7, H2 = 5
Approach: For the given numbers a and b, the maximum number c such that ax + by = c is not possible where x ≥ 0 and y ≥ 0 is Frobenius number which is equal to (a * b) – a – b.
Below is the implementation of the above approach:
Time Complexity: O(1)
- Maximum height of triangular arrangement of array values
- Find the height of a right-angled triangle whose area is X times its base
- Sqrt (or Square Root) Decomposition | Set 2 (LCA of Tree in O(sqrt(height)) time)
- Count Balanced Binary Trees of Height h
- Traversal of tree with k jumps allowed between nodes of same height
- Radius of the circle when the width and height of an arc is given
- Print the nodes of the Binary Tree whose height is a Prime number
- Percentage increase in the cylinder if the height is increased by given percentage but radius remains constant
- Percentage increase in the volume of cuboid if length, breadth and height are increased by fixed percentages
- Height of Pyramid formed with given Rectangular Box
- Count triangles required to form a House of Cards of height N
- Find Maximum and Minimum of two numbers using Absolute function
- Query to find the maximum and minimum weight between two nodes in the given tree using LCA.
- Maximum XOR value of maximum and second maximum element among all possible subarrays
- Program to find the maximum difference between the index of any two different numbers
- Find two equal subsequences of maximum length with at least one different index
- Find two numbers with given sum and maximum possible LCM
- Maximum weighted edge in path between two nodes in an N-ary tree using binary lifting
- Find area of triangle if two vectors of two adjacent sides are given
- Find the maximum distance covered using n bikes
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.