Basic Triangle Patterns

Logic Building DSA practice problem on Onlearn.

Difficulty: easy.

Topics: Learn Important Pattern Problems (Pattern Problems List for DSA Preparation), Time Complexity, Space Complexity, Big O Notation, Loops, Conditional Statements, complexity analysis, general programming, algorithm design, pattern recognition, Problem Solving Techniques, Control Flow.

""" Given a positive integer N, print a hollow diamond pattern where the perimeter of the diamond is filled with numbers. The numbers should start from 1 at the top most point and increment sequentially along the visible border. The interior of the diamond should be filled with spaces. Each number on the border should be separated by a single space from the adjacent number on the same row. Input Specification: A single integer N (1 <= N <= 9). Output Specification: The hollow diamond pattern as described. Constraints: 1 <= N <= 9 Sample Test Cases: Example 1: Input: 3 Output: 1 2 3 4 5 6 7 8 Example 2: Input: 1 Output: 1 """