5 kyu
[Code Golf] Counting Parallelograms
28dfhwze
Description:
Counting Parallelograms
Problem Overview
In this code golf challenge, you're tasked with creating a function that counts the number of parallelograms within a triangular pyramid structure. The function should take the height of the pyramid as input and return the count of parallelograms.
Constraints
- Code Length: Your solution must not exceed
29
characters. - Input: An integer representing the pyramid's height
h
(0 ≤ h ≤ 50
). - Output: The total number of parallelograms in the structure.
Pyramid Structure
The pyramid is composed of smaller triangles arranged in a triangular pattern. Parallelograms can be formed by combining these smaller triangles in various ways.
Example: Pyramid of height 5
Here's a parallelogram.
Here's another one.
Summary
This challenge combines geometric understanding with code golf techniques. The key is to recognize the pattern of parallelogram formation as the pyramid grows and to express this pattern in a highly condensed form of code.
Can you spot the 15
parallelograms in this triangle?
Good luck, Have fun!
Algorithms
Mathematics
Combinatorics
Geometry
Restricted
Similar Kata:
Stats:
Created | Dec 1, 2024 |
Published | Dec 1, 2024 |
Warriors Trained | 59 |
Total Skips | 1 |
Total Code Submissions | 584 |
Total Times Completed | 28 |
Python Completions | 28 |
Total Stars | 3 |
% of votes with a positive feedback rating | 97% of 16 |
Total "Very Satisfied" Votes | 15 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 7 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 6 kyu |