Skip to content

Common pattern printing problems for DSA interview preparation. Includes triangles, pyramids, diamonds, and more.

Notifications You must be signed in to change notification settings

Powar-Goutxm/dsa-patterns

Repository files navigation

DSA Pattern Problems 🎨

A comprehensive collection of pattern printing problems commonly asked in Data Structures and Algorithms interviews and competitive programming.

📋 Table of Contents

🎯 About

This repository contains well-documented pattern printing problems with:

  • Clean, readable code
  • Time and space complexity analysis
  • Visual output examples
  • Proper naming conventions

Perfect for:

  • Interview preparation
  • Learning nested loops
  • Understanding pattern logic
  • Practice for competitive programming

📦 Patterns Included

Basic Star Patterns

  1. Right-aligned Triangle (Decreasing)

    *****
    ****
    ***
    **
    *
    
  2. Right-aligned Triangle (Increasing)

    *
    **
    ***
    ****
    *****
    
  3. Left-aligned Triangle

        *
       **
      ***
     ****
    *****
    
  4. Full Pyramid

        *
       ***
      *****
     *******
    *********
    
  5. Inverted Pyramid

    *********
     *******
      *****
       ***
        *
    
  6. Hollow Rectangle

    *******
    *     *
    *     *
    *     *
    *******
    
  7. Diamond Pattern

        *
       ***
      *****
     *******
    *********
     *******
      *****
       ***
        *
    
  8. Half Diamond Star Pattern

    *
    **
    ***
    ****
    *****
    ****
    ***
    **
    *
    

Number Patterns

  1. Number Triangle (Decreasing)

    12345
    1234
    123
    12
    1
    
  2. Increasing Number Triangle

    1
    2 3
    4 5 6
    7 8 9 10
    11 12 13 14 15
    
  3. Binary Number Triangle

    1
    0 1
    1 0 1
    0 1 0 1
    1 0 1 0 1
    
  4. Number Crown Pattern

    1        1
    12      21
    123    321
    1234  4321
    1234554321
    

🚀 How to Use

  1. Clone the repository

    git clone https://github.com/Powar-Goutxm/dsa-patterns
    cd dsa-patterns
  2. Compile and run Basic Patterns

    javac BasicPatterns.java
    java BasicPatterns
  3. Compile and run Number Patterns

    javac NumberPatterns.java
    java NumberPatterns
  4. Modify for custom input

    // In main method, change the parameter
    right_pattern_reverse(10);  // For a triangle of size 10

📚 Pattern Categories

Available

  • ✅ Basic Star Patterns (8 patterns)
  • ✅ Number Patterns (4 patterns)

Coming Soon

  • Character Patterns (Alphabet triangles)
  • Butterfly Patterns
  • Wave Patterns
  • Spiral Patterns

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/NewPattern)
  3. Commit your changes (git commit -m 'Add some pattern')
  4. Push to the branch (git push origin feature/NewPattern)
  5. Open a Pull Request

Contribution Guidelines

  • Follow existing code style
  • Add proper documentation
  • Include time/space complexity
  • Add visual examples in comments
  • Test your patterns thoroughly

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🌟 Show your support

Give a ⭐️ if this project helped you!

📧 Contact

Goutam Powar - goutampowar005@gmail.com

Project Link: https://github.com/Powar-Goutxm/dsa-patterns


Happy Coding! 💻

About

Common pattern printing problems for DSA interview preparation. Includes triangles, pyramids, diamonds, and more.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages