0% found this document useful (0 votes)
2 views

Java Array Questions

The document lists common Java array interview questions along with example inputs and outputs. Key topics include combining arrays, finding minimum and maximum values, identifying pairs with a target sum, and handling duplicates. Additional questions cover finding the Kth largest element, the second largest element, and shifting values to the end of the array.

Uploaded by

rakeshlr1996
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Java Array Questions

The document lists common Java array interview questions along with example inputs and outputs. Key topics include combining arrays, finding minimum and maximum values, identifying pairs with a target sum, and handling duplicates. Additional questions cover finding the Kth largest element, the second largest element, and shifting values to the end of the array.

Uploaded by

rakeshlr1996
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Java Array Interview Questions (Most Asked)

1. Combine Two Array


🔸 Input: {1, 2, 3}, {4, 5, 6}
🔸 Output: [1, 2, 3, 4, 5, 6]

2. Find Min and Max in Array


🔸 Input: {3, 6, 9, 5, 20, 43}
🔸 Output: Min: 3, Max: 43
3. Find Pair with Target Sum
🔸 Input: {1, 2, 3, 4, 5}, Target = 5
🔸 Output: 3+2, 4+1

4. Frequency of Each Element


🔸 Input: {1, 2, 2, 3, 1, 4, 5, 1}
🔸 Output: 1 → 3 times, etc
5. Kth Largest Element
🔸 Input: {2, 5, 7, 8, 9, 6}, K = 3
🔸 Output: 7

6. Remove Duplicates
🔸 Input: {4, 2, 3, 2, 4, 1, 5, 3, 5}
🔸 Output: 1 2 3 4 5
7. Find Second Largest Element
🔸 Input: {4, 19, 3, 4, 16}
🔸 Output: 16

8. Shift a Value to End


🔸 Input: {1, 4, 5, 4, 3, 0, 3, 2, 0, 1}, Value = 1
🔸 Output: [4, 5, 4, 3, 0, 3, 2, 0, 1, 1]

You might also like