Ravi Ranjan has Published 148 Articles

Adam Number in C++

Ravi Ranjan

Ravi Ranjan

Updated on 11-Jul-2025 18:16:36

2K+ Views

The Adam number is a number such that the square of the given number 'n' is the reverse of the square of the reverse of that number 'n'. In this article, our task is to write a program that can check ... Read More

Find maximum sum of triplets in an array such than i < j < k and a[i] < a[j] < a[k] in C++

Ravi Ranjan

Ravi Ranjan

Updated on 01-Jul-2025 15:35:10

2K+ Views

In this article, we have an array of positive integers of size n. Our task is to calculate the maximum sum of triplet ( ai + aj + ak ) such that 0 sum = 12 3 6 10 => sum = 19 3 ... Read More

Count Triplets such that one of the numbers can be written as sum of the other two in C++

Ravi Ranjan

Ravi Ranjan

Updated on 01-Jul-2025 15:32:12

1K+ Views

In this article, We are given an array arr[] of integers with length n. Our task is to count the number of triplets such that the sum of any two numbers is equal to the third number. Example Here is an example of ... Read More

Reverse Words in a String in C++

Ravi Ranjan

Ravi Ranjan

Updated on 18-Jun-2025 19:19:54

6K+ Views

In this article, we have a string. Our task is to reverse the words in the given string. Here is an example of reversing the words of a string: Example The example below reverses the words of the given string: Input: "I am Viper" Output: Viper am I ... Read More

Four Divisors in C++

Ravi Ranjan

Ravi Ranjan

Updated on 17-Jun-2025 17:59:02

602 Views

In this article, we will understand the four divisors problem. We have an array of integers, and our task is to find the sum of divisors of the array elements that have exactly four divisors. If there is no such integer in the array, then ... Read More

Break a Palindrome in C++

Ravi Ranjan

Ravi Ranjan

Updated on 17-Jun-2025 17:57:32

2K+ Views

In this article, our task is to break a palindromic string. We have to replace exactly one character with any lowercase English letter such that the string becomes a lexicographically smallest possible string that isn't a palindrome. Now after doing so, we have to find ... Read More

C++ Program to Search for an Element in a Binary Search Tree

Ravi Ranjan

Ravi Ranjan

Updated on 16-Jun-2025 17:41:41

2K+ Views

A Binary Search Tree (BST) is a type of binary tree such that the left subtree has elements smaller than the root element and the right subtree has elements greater than the root element. In this article, our task is to search for an element in the given Binary Search ... Read More

Calling a member function on a NULL object pointer in C++

Ravi Ranjan

Ravi Ranjan

Updated on 13-Jun-2025 18:53:46

1K+ Views

You can call a class member function using a NULL object pointer in C++. This is an undefined behavior and there is no guarantee about the execution of the program. The actual results depend on the compiler used. Class Member Function A ... Read More

Minimum removals to make array sum even in C++

Ravi Ranjan

Ravi Ranjan

Updated on 12-Jun-2025 17:20:06

252 Views

In this article, we have an array arr[] of N integers. Our task is to write a program to find the minimum number of elements needed to be removed from the given array so that the sum of the remaining elements is even. ... Read More

Minimum removals to make array sum odd in C++

Ravi Ranjan

Ravi Ranjan

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

266 Views

In this article, we have an array arr[] of N integers. Our task is to write a program to find the minimum number of elements needed to be removed from the given array so that the sum of the remaining elements is odd. Example ... Read More

Advertisements