5 kyu

[Code Golf] Counting Parallelograms

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:

More By Author:

Check out these other kata created by dfhwze

Stats:

CreatedDec 1, 2024
PublishedDec 1, 2024
Warriors Trained59
Total Skips1
Total Code Submissions584
Total Times Completed28
Python Completions28
Total Stars3
% of votes with a positive feedback rating97% of 16
Total "Very Satisfied" Votes15
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes0
Total Rank Assessments7
Average Assessed Rank
5 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • dfhwze Avatar
  • anter69 Avatar
Ad