Nishu Kumari has Published 122 Articles

Find the longest prefix in a string that has the highest frequency across the string.

Nishu Kumari

Nishu Kumari

Updated on 27-Mar-2025 15:02:49

80 Views

In this article, we'll discuss the problem of finding the longest prefix in a string that has the highest frequency (appears most often) across the string. We'll break it down step-by-step and show how to efficiently solve this problem. Given a string, we need to find the longest prefix (the ... Read More

How to resolve a name conflict in C++

Nishu Kumari

Nishu Kumari

Updated on 27-Mar-2025 14:58:44

186 Views

In C++, a name conflict occurs when two or more identifiers, such as variables, functions, or classes, share the same name within the same scope. This creates ambiguity because the compiler may struggle to distinguish between them, leading to compilation errors. In this article, we will discuss name conflicts in ... Read More

How to pass an array into a lambda function in C++

Nishu Kumari

Nishu Kumari

Updated on 27-Mar-2025 14:55:25

181 Views

In this article, we will learn how to pass an array into a lambda function in C++. A lambda function is a small, anonymous function that doesn't have a name and can access variables from the surrounding code. Passing an array to a lambda function is a bit different ... Read More

How to initialize multi-set with custom comparator in C++

Nishu Kumari

Nishu Kumari

Updated on 27-Mar-2025 14:47:12

177 Views

In this article, we will learn how to initialize a std::multiset with a custom comparator in C++. A multiset is similar to a set, except that it allows duplicate elements. It stores elements in a sorted order based on a comparison function. By default, elements are compared using the < ... Read More

Count maximum number of disjoint pairs having one element not less than k times the other in C++

Nishu Kumari

Nishu Kumari

Updated on 24-Mar-2025 15:23:03

90 Views

In this article, we will discuss how to count the maximum number of disjoint pairs in an array, where for each pair (x, y), one element is not less than K times the other. The goal is to find the number of such valid pairs in the array using ... Read More

Count pairs whose Bitwise AND exceeds Bitwise XOR from a given array

Nishu Kumari

Nishu Kumari

Updated on 24-Mar-2025 15:22:24

98 Views

In this article, we will learn how to count pairs of numbers from a given array where the bitwise AND of the two numbers is greater than the bitwise XOR. Bitwise operations work on the individual bits of numbers. The AND operation results in 1 only when both bits are ... Read More

C++ program for mirror of matrix across diagonal

Nishu Kumari

Nishu Kumari

Updated on 24-Mar-2025 15:21:04

154 Views

In this article, we will discuss how to create a C++ program to generate the mirror image of a matrix across its diagonal. The diagonal mirror of a matrix means that we swap the elements at symmetric positions with respect to the diagonal. Let's break down the problem step by ... Read More

How to find the greatest divisor that divides all the natural numbers in a given range [L, R]

Nishu Kumari

Nishu Kumari

Updated on 24-Mar-2025 15:20:37

103 Views

In this article, we will explain how to find the greatest divisor that divides all the natural numbers in a given range [L, R]. The task is to identify the largest number that can divide every number between L and R, including both L and R. For example, in the ... Read More

C++ Program to Sum the digits of a given number

Nishu Kumari

Nishu Kumari

Updated on 03-Mar-2025 13:17:07

13K+ Views

The task is to write C++ programs that calculates the sum of the digits of a given number. For example, if the number is 453, the sum of its digits would be 4 + 5 + 3 = 12. To solve this, we will extract each digit from the ... Read More

C++ Program to Implement Min Heap

Nishu Kumari

Nishu Kumari

Updated on 03-Mar-2025 13:16:55

12K+ Views

In this article, we will write a C++ program that implements a Min Heap. A Min Heap is a binary tree where the value of each node is less than or equal to the values of its children. We will explain how to create a Min Heap using arrays and ... Read More

Advertisements