DevJourney · code I wrote while learning

Binary LED Patterns

2 items

README.md

Binary LED Patterns

Single File Programming Question Problem Statement Meera is testing binary LED patterns for a grid display where the pattern alternates between 1 and 0 row-wise. She wants to generate an n × n matrix where odd-numbered rows (1-based) are filled with 1s and even-numbered rows with 0s. She uses the class BinaryPattern and the method generatePattern() to create and display this matrix. Input format : The first line of input contains an integer n, representing the size of the matrix. Output format : The output displays n lines, each containing n space-separated binary digits (1 or 0). Refer to the sample output for formatting specifications. Code constraints : The given testcases fall under the following constraints: 1 ≤ n ≤ 100 Sample test cases : Input 1 : 4 Output 1 : 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 Input 2 : 2 Output 2 : 1 1 0 0