A comprehensive collection of pattern printing problems commonly asked in Data Structures and Algorithms interviews and competitive programming.
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
-
Right-aligned Triangle (Decreasing)
***** **** *** ** * -
Right-aligned Triangle (Increasing)
* ** *** **** ***** -
Left-aligned Triangle
* ** *** **** ***** -
Full Pyramid
* *** ***** ******* ********* -
Inverted Pyramid
********* ******* ***** *** * -
Hollow Rectangle
******* * * * * * * ******* -
Diamond Pattern
* *** ***** ******* ********* ******* ***** *** * -
Half Diamond Star Pattern
* ** *** **** ***** **** *** ** *
-
Number Triangle (Decreasing)
12345 1234 123 12 1 -
Increasing Number Triangle
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 -
Binary Number Triangle
1 0 1 1 0 1 0 1 0 1 1 0 1 0 1 -
Number Crown Pattern
1 1 12 21 123 321 1234 4321 1234554321
-
Clone the repository
git clone https://github.com/Powar-Goutxm/dsa-patterns cd dsa-patterns -
Compile and run Basic Patterns
javac BasicPatterns.java java BasicPatterns
-
Compile and run Number Patterns
javac NumberPatterns.java java NumberPatterns
-
Modify for custom input
// In main method, change the parameter right_pattern_reverse(10); // For a triangle of size 10
- ✅ Basic Star Patterns (8 patterns)
- ✅ Number Patterns (4 patterns)
- Character Patterns (Alphabet triangles)
- Butterfly Patterns
- Wave Patterns
- Spiral Patterns
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/NewPattern) - Commit your changes (
git commit -m 'Add some pattern') - Push to the branch (
git push origin feature/NewPattern) - Open a Pull Request
- Follow existing code style
- Add proper documentation
- Include time/space complexity
- Add visual examples in comments
- Test your patterns thoroughly
This project is licensed under the MIT License - see the LICENSE file for details.
Give a ⭐️ if this project helped you!
Goutam Powar - goutampowar005@gmail.com
Project Link: https://github.com/Powar-Goutxm/dsa-patterns
Happy Coding! 💻