#
Array Archive

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. …

If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. Given an array of integers representing stock price on single day, find max profit that can …

If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. Problem: You are given arrival and departure time of trains reaching to a particular station. You …