Find Angle MBC - HackerRank Solution Python

Featured image

Find Angle MBC is a medium-difficulty problem that involves the use of trigonometry concepts to solve the problem. We will learn how to solve this problem in Python through a step-by-step tutorial in Python3.

Problem Statement and Explanation

Given the length of sides AB and BC of a right triangle ABC, we have to find the angle MBC in degrees. Suppose ABC is a right triangle where the angle ABC is 90 degrees. The angle bisector of angle ABC meets the side AC at point M. We have to find the angle MBC in degrees.

Input Format

AB & BC are natural numbers and are between 0 and 100.

Output Format

Find Angle MBC Solution in Python

Explanation of Solution

Step by step explanation of the above code is given below:

Time Complexity of the Solution

The time complexity of the solution is O(1). This is because the function find_angle_mbc() only performs a constant number of operations, regardless of the lengths of sides AB and BC. The only operation that is performed is the math.atan() function, which takes a constant amount of time to execute.

Space Complexity of the Solution

The space complexity of the solution is O(1). This is because the function find_angle_mbc() only uses a constant amount of memory, regardless of the lengths of sides AB and BC. The only variables that are used are ab, bc, and degree, which are all scalars. Scalars are variables that store a single value, such as an integer or a float. They do not require any additional memory beyond the space required to store the value.

Test Case of the Find Angle MBC

find angle mbc codeperfectplus