0% found this document useful (0 votes)
8 views1 page

Array Java Problems

The document outlines a series of programming problems categorized into easy, medium, and hard levels. Easy problems include tasks like summing array elements and finding maximum values, while medium problems involve transposing matrices and calculating diagonal sums. Hard problems challenge the reader with tasks such as spiral order traversal and Kadane's algorithm for maximum subarray sum.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Array Java Problems

The document outlines a series of programming problems categorized into easy, medium, and hard levels. Easy problems include tasks like summing array elements and finding maximum values, while medium problems involve transposing matrices and calculating diagonal sums. Hard problems challenge the reader with tasks such as spiral order traversal and Kadane's algorithm for maximum subarray sum.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Easy Problems

●​ Sum of array elements: Write a program to declare an int array of size 5, input
values, and print their sum using a for loop.​
●​ Find maximum in array: Create an int array, input 6 numbers, and print the
largest using linear search (initialize max with first element).​
●​ Reverse a 1D array: Input 5 integers into an array and print them in reverse
order without using extra space.​
●​ 2D array row sum: Declare a 3x3 int 2D array, hardcode values, and print the
sum of each row.​
●​ Print 2D matrix: Input a 2x4 2D array and display it in matrix format with
proper spacing.​
Medium Problems
●​ Transpose of 2D array: Read a 3x3 matrix into a 2D array and print its
transpose (swap rows and columns).​
●​ Transpose of 2D array(without using extra space): Read a 3x3 matrix into a 2D
array and change itself into transpose (swap rows and columns)and print the
matrix.
●​ Diagonal sum in 2D: For a 4x4 2D array, compute and print the sum of main
diagonal elements (top-left to bottom-right).​
●​ Jagged array input/output: Create a jagged array with 3 rows (sizes 2, 3, 4),
input values, and print row-wise.​
●​ Search in 2D array: Input a 5x5 2D array and search for a user-given number,
printing its row and column indices.​
●​ Rotate array left: Shift all elements of a 1D array of size 7 one position left
(first element goes to end).​
Hard Problems
●​ Spiral order 2D traversal: Traverse a 4x4 2D array in spiral order (outer to inner
clockwise) and print elements.​
●​ Jagged array transpose: Create a jagged array (rows of varying lengths),
transpose it (columns become rows), handling irregular sizes.​
●​ Wave print 2D array: Print a MxN 2D array in wave form: each row left-to-right
for even rows, right-to-left for odd.​
●​ Kadane's max subarray sum: Find the maximum sum of any contiguous
subarray in a 1D array of 10 negatives/positives.​
●​ Jagged array sort rows: Create a jagged int array (4 rows varying lengths), sort
each row ascending, then print all.​

You might also like