Maximum Consecutive Numbers Present in an Array

Problem Statement Suppose you have an array of integers of size N. The problem “Maximum consecutive numbers present in an array” asks to find out the maximum count of consecutive numbers that could be scattered in an array. Example arr[] = {2, 24, 30, 26, 99, 25} 3 Explanation: The …

Move all negative elements to one side of array

Move all negative elements to one side of array – Suppose you have an array of integers. It consists of both negative and positive numbers and the problem statement asks to shift/move all the negative and positive elements to the left of the array and to the right of the …

Total Numbers With no Repeated Digits in a Range

You are given a range of numbers (start, end). The given task says to find out the total numbers of numbers with no repeated digits in a range. Example Input: 10 50 Output: 37 Explanation: 10 has no repeated digit. 11 has a repeated digit. 12 has no repeated digit. …

Find top three repeated in array

The problem “Find top three repeated in array” states that you are given an array of n numbers with some repeated numbers in it. Your task is to find out the top 3 repeated numbers in an array. Example [1,3,4,6,7,2,1,6,3,10,5,7] 1 3 6 Explanation Here 1,3 and 6 are repeated …

Sorting using trivial hash function

The problem “Sorting using trivial hash function” states that you are given an integer array. An array can be containing both negative and positive numbers. The problem statement asks to sort the array using Trivial Hash Function. Example arr[] = {5,2,1,3,6} {1, 2, 3, 5, 6} arr[] = {-3, -1, …

Find duplicates in a given array when elements are not limited to a range

The problem “Find duplicates in a given array when elements are not limited to a range” states that you have an array consisting of n integers. The problem statement it to find out the duplicate elements if present in the array. If no such element exists return -1. Example [ …

Check if two arrays are equal or not

The problem “Check if two arrays are equal or not” states that you are given two arrays. The problem statement says that you have to determine if given arrays are equal or not. Example arr1[] = { 1, 4, 2, 5, 2 }; arr2[] = { 2, 1, 5, 4, …

Write a function to get the intersection point of two Linked Lists

Problem Statement The problem “Write a function to get the intersection point of two Linked Lists” states that you are given two linked lists. But they are not independent linked lists. They are connected at some point. Now you need to find this point of intersection of these two lists. …