Hafeezul Kareem has Published 345 Articles

Create linked list from a given array in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 15-Sep-2023 02:23:32

25K+ Views

In this tutorial, we are going to learn how to create a linked list from the given array.Let's see the steps to solve the problem.Initialize the array with dummy data.Write the struct node.Iterate over the array.Create a new node with the data.Insert the new node into the linked list.Print the ... Read More

Adding a new column to existing DataFrame in Pandas in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 26-Aug-2023 08:39:59

28K+ Views

In this tutorial, we are going to learn how to add a new column to the existing DataFrame in pandas. We can have different methods to add a new column. Let's all of them.Using ListWe can add a new column using the list. Follow the steps to add a new ... Read More

List frequency of elements in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 26-Aug-2023 03:26:58

37K+ Views

In this article, we are going to learn how to find the frequency of elements in a Python list. We can solve the problem in different ways. Let's see two of them.Follow the below steps to write the code.Initialize the list with elements and an empty dictionary.Iterate over the list ... Read More

Multiples of 3 and 5 without using % operator in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 27-Oct-2021 06:28:22

397 Views

We can find the multiples using % operator without any hurdles. But, the problem states that we can't use % operator.Here, we make use of the + operator. We can get the multiples by adding 3 or 5 to the previous multiple. Let's see an example.Input15Output1 2 3 - Multiple ... Read More

Nearest 1 in a binary matrix in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 27-Oct-2021 05:34:37

160 Views

Given a binary matrix, we need to find the minimum distance from each cell to the nearest cell that contains 1.Let's see an example.Input0 0 1 1 1 0 0 0 0Output1 1 0 0 0 1 1 1 2The minimum distance is the one that is minimum from current ... Read More

Number of pairs with maximum sum in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 26-Oct-2021 19:25:03

288 Views

Given an array, we need to find the number of pairs with maximum sum. Let's see an example.Inputarr = [3, 6, 5, 2, 1, 2, 3, 4, 1, 5]Output2 The maximum pair sum is 10. There are 2 pairs with maximum sum. They are (5, 5) and (6, 4).AlgorithmInitialise the ... Read More

Number of pairs with Bitwise OR as Odd number in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 26-Oct-2021 19:18:54

144 Views

Given an array, we have to find the number of pairs whose Bitwise OR is an odd number. Let's see the example.Inputarr = [1, 2]Output1 There is only one pair whose Bitwise OR is an odd number. And the pair is (1, 2).AlgorithmInitialise the array with random numbers.Initialise the count ... Read More

Number of pairs whose sum is a power of 2 in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 26-Oct-2021 19:09:44

767 Views

Given an array, we have to find the number of pairs whose sum is a power of 2. Let's see the example.Inputarr = [1, 2, 3]Output1 There is only one pair whose sum is a power of 2. And the pair is (1, 3).AlgorithmInitialise array with random numbers.Initialise the count ... Read More

Number of pairs from the first N natural numbers whose sum is divisible by K in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 26-Oct-2021 18:56:50

117 Views

Given numbers N and K, we have to count the number of pairs whose sum is divisible by K. Let's see an example.InputN = 3 K = 2Output1 There is only one pair whose sum is divisible by K. And the pair is (1, 3).AlgorithmInitialise the N and K.Generate the ... Read More

Number of ordered points pair satisfying line equation in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 26-Oct-2021 18:42:03

102 Views

The line equation that should be satisfied is y = mx + c. Given an array, m, and c, we have to find the number of order points satisfying the line equation. Let's see an example.Inputarr = [1, 2, 3] m = 1 c = 1Output2The pairs satisfying the line ... Read More

1 2 3 4 5 ... 35 Next
Advertisements