Nishu Kumari

Nishu Kumari

Technical Content Engineer

88 Articles Published

Articles by Nishu Kumari

Page 8 of 9

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

C++
Nishu Kumari
Nishu Kumari
Updated on 24-Mar-2025 216 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 1, while XOR gives 1 when the bits are different. Given an array of integers, we need to count how many pairs (i, j) exist such that the bitwise AND of the pair is greater than the bitwise XOR. In other words, for each pair of elements in the ...

Read More

C++ program for mirror of matrix across diagonal

C++
Nishu Kumari
Nishu Kumari
Updated on 24-Mar-2025 383 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 step and then look at the code that solves this problem. Understanding the Problem For any given matrix, the mirror image across the diagonal means that the element at position (i, j) will be swapped with the element at position (j, i). This operation is also known as transposing ...

Read More

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

C++
Nishu Kumari
Nishu Kumari
Updated on 24-Mar-2025 255 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 range [6, 9] (which includes 6, 7, 8, and 9), the GCD is 1 because no number greater than 1 divides all of them. Now, let's go through the steps to solve this problem. Approach to Solve the Problem To solve this problem, we can follow these steps: ...

Read More

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

Nishu Kumari
Nishu Kumari
Updated on 03-Mar-2025 15K+ 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 number and add them together. We will use basic programming concepts such as loops and arithmetic operations to achieve this. In this article, we will show you how to write a C++ program that takes a number as input and sums the digits of that number. Approaches for ...

Read More

C++ Program to Implement Min Heap

Nishu Kumari
Nishu Kumari
Updated on 03-Mar-2025 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 implement operations like insertion and deletion. The article will cover the following topics: What is a Heap? Types of Heap Representing a Heap What is a Min Heap? What ...

Read More

Descending order in Map and Multimap of C++ STL

Nishu Kumari
Nishu Kumari
Updated on 30-Jan-2025 4K+ Views

Generally, the default behavior of map and multimap map is to store elements is in ascending order. But we can store element in descending order by using the greater function. Map in Descending Order We use a map to store elements in descending order with the help of the greater function. We perform various operations like inserting elements, finding an element, counting occurrences of keys, and removing elements from the map. Functions are used here - m::find() – Returns an iterator to the element with key value ‘b’ in the map if found, else returns the iterator to ...

Read More

Sorting a vector in C++

Nishu Kumari
Nishu Kumari
Updated on 30-Jan-2025 19K+ Views

Sorting a vector in C++ means arranging its elements in a specific order, like ascending or descending. This is a common task when you need to organize data efficiently. C++ provides different ways to sort a vector. In this article, we will look at different ways to sort a vector in C++. Let's look at this example to better understand it: For the vector: V = {5, 3, 8, 1, 2} Sorted Output: {1, 2, 3, 5, 8} For the vector: V = {22, 23, 5, 6, 34} Sorted Output: {5, 6, 22, 23, 34} Approaches to ...

Read More

SQL Query to Find the Highest Salary of Each Department

SQL
Nishu Kumari
Nishu Kumari
Updated on 17-Jan-2025 267 Views

SQL (Structured Query Language) is a programming language used to manage and interact with databases. In this case, the goal is to find the highest salary in each department from a table that contains employee data, including their salaries and the departments they work in. We'll write an SQL query to find the highest salary for each department, which is useful for analyzing salary trends, setting pay standards, and making informed business decisions. Finding the Highest Salary of Each Department To find the highest salary in each department, use SQL's GROUP BY and MAX() functions. The GROUP BY ...

Read More

SQL Query for Matching Multiple Values in the Same Column

SQL
Nishu Kumari
Nishu Kumari
Updated on 17-Jan-2025 589 Views

To query data in SQL where you need to match multiple values within the same column, you can use operators like IN and OR. For example, how would you find employees in the "Sales" or "Marketing" departments, or list those with job titles like "Manager" or "Salesperson"? These are common scenarios when filtering data based on multiple conditions in SQL: The IN operator allows you to match values from a list, while OR helps combine multiple conditions efficiently. In this article, we'll show you how to write SQL queries to match multiple values within the same column, making it easier ...

Read More

How to Select Data Between Two Dates and Times in SQL Server?

SQL
Nishu Kumari
Nishu Kumari
Updated on 17-Jan-2025 305 Views

Sometimes, you need to get data from SQL Server that falls between two specific dates or times, like finding all orders placed within a week or all activities that happened during a certain time frame. Writing the right query can be challenging if you're not familiar with how to filter data by date and time. In this article, we will show you how to easily select data between two dates and times in SQL Server using simple queries. Steps to Write Queries for Selecting Data Between Dates and Times As we're going to write queries to filter data ...

Read More
Showing 71–80 of 88 articles
« Prev 1 5 6 7 8 9 Next »
Advertisements