# Category: Array

## Check if a given array contains duplicate elements within k distance from each other

Problem: Write a Java program to check if a given unsorted array contains duplicate elements within k distance from each other. For example: If k = 3 and array is …

## Duplicate elements in array in Java

Problem: Write a Java program to find duplicate elements in array. This is entry-level interview question and interviewers are interested to see if you can solve the problem with …

## Second largest number in an array

Problem: Find the second largest number in an array. This program is asked in entry-level interviews. In this article we will see how to find second largest number in array in …

## k largest elements / smallest elements in an array

Problem: Given an array of size n, find first k largest elements (smallest elements) in the array. This program is asked in interviews to check how efficiently you can …

## Matrix multiplication program in Java

Problem: Write a program in Java for matrix multiplication. This program is a college level program. This program is asked in entry level interviews to see if you can handle …

## First repeating element in array in Java

Problem: First repeating element in array. Given an array of integers, find the first repeating number in the array. Example: Input array, arr = Then first repeating number …

## Find missing number in an array in Java

Problem: Find missing number in an array. Given an array of size n-1, populated with numbers from 1 to n. There are no duplicates in the array. Find the …

## Transpose matrix in Java

In this article we will see how to transpose a matrix in Java. This is an algebra problem and asked in entry level interviews. Transpose matrix is similar to rotating …

## Rotate matrix by 90 degrees

Problem: Rotate matrix by 90 degrees. In this article we will see how to rotate a matrix by 90 degrees to right. This program is asked in programming interviews. …

## N largest numbers from three sorted arrays

Problem: Find N largest numbers from 3 sorted arrays. Ex: Given 3 sorted arrays, { 3, 7, 10, 14, 19, 78, 78, 200 }, { 4, 7, 67, 116, …