//Seating Arrangement
Each row in a theater can have a different number of seats.
Store the seat status (true = booked, false = free).
Book or cancel seats dynamically.
//Validate if all rows of a 9x9 sudoku grid contain all digits 1-9 with no
repetition.
int[][] sudoku = {
{5, 3, 4, 6, 7, 8, 9, 1, 2},
{6, 7, 2, 1, 9, 5, 3, 4, 8},
{1, 9, 8, 3, 4, 2, 5, 6, 7},
{8, 5, 9, 7, 6, 1, 4, 2, 3},
{4, 2, 6, 8, 5, 3, 7, 9, 1},
{7, 1, 3, 9, 2, 4, 8, 5, 6},
{9, 6, 1, 5, 3, 7, 2, 8, 4},
{2, 8, 7, 4, 1, 9, 6, 3, 5},
{3, 4, 5, 2, 8, 6, 1, 7, 9}
};
//Count and display the frequency of each unique element in an array.
//Print the elements of a 2D matrix in spiral order:
Left → Right
Top → Bottom
Right → Left
Bottom → Top (and repeat)
int[][] matrix = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}
};
Spiral Order:
1 2 3 6 9 8 7 4 5