#
Array Archive

In this post, we will see how to find the first repeating element in array of integers. Problem Find the first repeating element in array of integers. For example: Input: array = {10, 7, 8, …

In this post, we will see how to check if array elements are consecutive. Problem Given an array, we need to check if array contains consecutive elements. For example: Input: array = {5, 3, 4, …

In this post, we will see how to print all subarrays of given array. Problem Print all print all subarrays of given array. For example: If array is {1,2,3} then you need to print {1}, …

In this post, we will see how to find all permutations of the array in java. Problem 1 Given array of distinct integers, print all permutations of the array. For example: array : Permuations are …

In this post, we will learn java set to array conversion. There are many ways to convert set to an array. 1. Using Java 8’s Stream If you are using Java 8, I would recommend …

Kadane algorithm is a famous algorithm to solve maximum subarray problem. Maximum subArray problem: From Wikipedia : In computer science, the maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional …

In this post, we will see about quick sort in java. Quick sort or partition-exchange sort, is a sorting algorithm, which is using divide and conquer algorithm. In quick sort, we first choose a pivot …

In this post, we will see how to sort an array in java. There are various ways to sort array in java. You can implement different sorting algorithms to sort an array. You can use …

If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. In this post, we will see how to find transpose of matrix in java. Transpose of …

Given array of integers, find Maximum difference between two elements such that larger element appears after the smaller number For example: Algorithm: Lets say we have array arr of stock prices. We will track two variable :minElementTillNow and maxDifference. …