A lizard is present on one corner of cube, It wants to reach diagonally opposite corner of cube. You have to calculate minimum distance lizard has to cover to reach its destination.
Note : Lizard can’t fly, it moves along the wall.
You are given a representing side of cube.you have to calculate minimum distance lizard has to travel.
Input : 5 Output :11.1803 Input :2 Output :4.47214
As we have to calculate the minimum distance from one corner to another diagonally opposite corner. if lizard able to fly then the shortest distance will be length of diagonal. But it can’t.
So, to calculate minimum distance, just open the cube, as describe in diagram.
Let us suppose, lizard is initially at point E.and it has to reach at point A(as A is diagonally opposite to E).Now we have to find AE.
Just use Pythagoras theorem, As
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.
- Puzzle 31 | (Minimum cut Puzzle)
- Count paths with distance equal to Manhattan distance
- Distance of chord from center when distance between center and another equal length chord is given
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle | ( Distance, Time and Work)
- Puzzle | Find The Probability of Distance in a Square
- Puzzle 24 | (10 Coins Puzzle)
- Puzzle 27 | (Hourglasses Puzzle)
- Puzzle 28 | (Newspaper Puzzle)
- Puzzle 29 | (Car Wheel Puzzle)
- Puzzle 33 | ( Rs 500 Note Puzzle )
- Puzzle 34 | (Prisoner and Policeman Puzzle)
- Puzzle 36 | (Matchstick Puzzle)
- Puzzle 38 | (Tic Tac Toe Puzzle)
- Puzzle 39 | (100 coins puzzle)
- Puzzle 51| Cheryl’s Birthday Puzzle and Solution
- Puzzle 81 | 100 people in a circle with gun puzzle
- Puzzle 85 | Chain Link Puzzle
- Puzzle | Elevator Puzzle
- Puzzle | 3 Priests and 3 devils Puzzle
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.