How to Find the Row of the Odd Triangle in Python
The challenge
Given a triangle of consecutive odd numbers:
find the triangle’s row knowing its index (the rows are 1-indexed), e.g.:
Note: your code should be optimized to handle big inputs.
The solution in Python code
Option 1:
Option 2:
Option 3:
|
|
Test cases to validate our solution
|
|