Ravi Ranjan has Published 148 Articles

Count elements smaller than or equal to x in a sorted matrix in C++

Ravi Ranjan

Ravi Ranjan

Updated on 12-Jun-2025 17:19:15

242 Views

In this article, we are given a matrix of size m x n and an integer variable X. The row elements and the first column of the matrix are sorted in increasing order. Our task is to count the number of elements that are equal ... Read More

Count distinct elements in an array in C++

Ravi Ranjan

Ravi Ranjan

Updated on 11-Jun-2025 18:42:43

8K+ Views

In this article, we have an unsorted array of integers having repetitive elements. Our task is to count the distinct elements in the given array in C++. Example Here is an example of counting the unique number in the given array: Input: array = {4, 2, 32, ... Read More

A Sum Array Puzzle in C++?

Ravi Ranjan

Ravi Ranjan

Updated on 11-Jun-2025 18:41:02

243 Views

In this article, we will solve a sum array puzzle, where we have an array with n elements. We have to create another array of n elements such that the 'ith' position of the second array will hold the sum of all elements of the ... Read More

Count elements less than or equal to a given value in a sorted rotated array in C++

Ravi Ranjan

Ravi Ranjan

Updated on 10-Jun-2025 17:50:57

522 Views

A sorted and rotated array is an array that is sorted in ascending or descending order and then rotated either left or right by a specific number of elements. There should exist exactly one pivot point around which the array is rotated. Example Here ... Read More

Count of smaller or equal elements in the sorted array in C++

Ravi Ranjan

Ravi Ranjan

Updated on 10-Jun-2025 17:46:52

1K+ Views

In this article, we have a sorted array of integers. Our task is to find the count of elements of the given sorted array that are less than or equal to the given value K. Example Here are some examples of counting the array elements smaller than the given ... Read More

Find the number of elements greater than k in a sorted array using C++

Ravi Ranjan

Ravi Ranjan

Updated on 10-Jun-2025 17:46:06

1K+ Views

In this problem, we are given an array arr[] consisting of N sorted integer values and an integer k. Our task is to Find the number of elements greater than k in a sorted array. Example Here are some examples of counting the array elements greater than the given target ... Read More

JavaScript Program for Number of Local Extrema in an Array

Ravi Ranjan

Ravi Ranjan

Updated on 09-Jun-2025 19:15:46

235 Views

JavaScript Program for the Number of local extrema in an array is a common problem in the field of computer science and data analysis. Local extrema are the peaks and valleys in a sequence of numbers. In this article we are having two arrays, our task is to write a ... Read More

Maximum element in a sorted and rotated array in C++

Ravi Ranjan

Ravi Ranjan

Updated on 09-Jun-2025 19:15:30

567 Views

A sorted and rotated array is an array that is sorted in ascending or descending order and then rotated either left or right by a specific number of elements. There should exist exactly one pivot point around which the array is rotated. In ... Read More

Find Minimum in Rotated Sorted Array in C++

Ravi Ranjan

Ravi Ranjan

Updated on 09-Jun-2025 19:15:17

329 Views

A sorted and rotated array is an array that is sorted in ascending or descending order and then rotated either left or right by a specific number of elements. There should exist exactly one pivot point around which the array is rotated. In ... Read More

JavaScript Program for Block Swap Algorithm for Array Rotation

Ravi Ranjan

Ravi Ranjan

Updated on 06-Jun-2025 19:37:06

308 Views

To implement block swap algorithm for array rotation, we will be understanding three different approaches. Rotation of the array elements means moving the elements of the given array to either the left or right side by some number of specific positions. Block swap algorithm for array rotation means to rotate ... Read More

Previous 1 ... 3 4 5 6 7 ... 15 Next
Advertisements