Welcome To Tutorialspoint.dev
Officially launched 18th May 2019
Arrays Hash Arrays

Find three element from different three arrays such that that a + b + c = sum

Given three integer arrays and a “sum”, the task is to check if there are three elements a, b, c such that a + b + c = sum and a, b and c belong to thre...
Arrays Hash Microsoft

Print all subarrays with 0 sum

Given an array, print all subarrays in the array which has sum 0. Examples: Input: arr = [6, 3, -1, -3, 4, -2, 2, 4, 6, -12, -7] Output: Subarray foun...
Arrays Hash binary-string

Count subarrays with equal number of 1’s and 0’s

Given an array arr[] of size n containing 0 and 1 only. The problem is to count the subarrays having equal number of 0’s and 1’s. Examples: Input : arr[...
Arrays Hash subarray

Subarrays with distinct elements

Given an array, the task is to calculate the sum of lengths of contiguous subarrays having all elements distinct. Examples: Input : arr[] = {1, 2, 3} Output : 10 {1,...
Arrays Hash sliding-window

Count subarrays having total distinct elements same as original array

Given an array of n integers. Count total number of sub-array having total distinct elements same as that of total distinct elements of original array. Examples: Inp...
Arrays Hash Sorting

Maximum array from two given arrays keeping order same

Given two same sized arrays A[] and B[] (both arrays contain distinct elements individually but may have some common elements), task is to form a third (or result) ar...
Arrays Hash subarray

Count subarrays with same even and odd elements

Given an array of N integers, count number of even-odd subarrays. An even – odd subarray is a subarray that contains the same number of even as well as odd int...
Arrays Heap Sorting

Merge k sorted arrays Set 1

Given k sorted arrays of size n each, merge them and print the sorted output. Example: Input: k = 3, n = 4 arr[][] = { {1, 3, 5, 7}, {2, 4, 6, 8}, ...
Arrays Heap Order-Statistics

K maximum sum combinations from two arrays

Given two equally sized arrays (A, B) and N (size of both arrays). A sum combination is made by adding one element from array A and another element of array B. Displa...
Sorting Linked-List-Sorting Merge Sort

Why Quick Sort preferred for Arrays and Merge Sort for Linked Lists?

Why is Quick Sort preferred for arrays? Below are recursive and iterative implementations of Quick Sort and Merge Sort for arrays. Recursive Quick Sort for array. Ite...

Subscribe to Our Newsletter