- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Python Program for Maximum height when coins are arranged in a triangle

In this article, we will learn about the solution to the problem statement given below.

**Problem statement** − We are given N coins where we need to arrange them in form of a triangle, i.e. in the first row will have 1 coin, the second row will have 2 coins and so on, we need to display the maximum height that can be achieved by the help N coins.

Now let’s observe the solution in the implementation below −

## Example

# squareroot def squareRoot(n): # initial approximation x = n y = 1 e = 0.000001 # allowed error while (x - y > e): x = (x + y) / 2 y = n/x return x # max height def find(N): # calculating portion of the square root n = 1 + 8*N maxH = (-1 + squareRoot(n)) / 2 return int(maxH) # main N = 17 print("Maximum height is :",find(N))

## Output

Maximum height is : 5

All the variables are declared in the local scope and their references are seen in the figure above.

## Conclusion

In this article, we have learned about how we can make a Python Program for Maximum height when coins are arranged in a triangle.

- Related Articles
- C/C++ Program for Maximum height when coins are arranged in a triangle?
- Program to find maximum coins we can get from disappearing coins matrix in Python
- Program to find maximum number of coins we can collect in Python
- Program to find maximum building height in Python
- Program to find a matrix for each condominium's height is increased to the maximum possible height in Python?
- Program to find maximum number of coins we can get using Python
- Program to find maximum XOR for each query in Python
- Program to find number of coins needed to make the changes with given set of coins in Python
- Program to find maximum weighted sum for rotated array in Python
- Problem to Find Out the Maximum Number of Coins that Can be Collected in Python
- When are python objects candidates for garbage collection?
- Write a Program to Find the Maximum Depth or Height of a Tree in C++
- Find the probability of getting exactly one head when two coins are tossed.
- Maximum path sum in a triangle in C++
- Program to find number of coins needed to make the changes in Python

Advertisements