Hafeezul Kareem has Published 328 Articles

Find unique pairs such that each element is less than or equal to N in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 29-Dec-2020 10:43:17

126 Views

In this tutorial, we are going to learn how to find the unique pairs that are less than the given number n.Let's see the steps to solve the problem.Initialize the number.Iterate from i = 1 to i < n.Iterate from j = i + 1 to j < n.Print the ... Read More

Find Union and Intersection of two unsorted arrays in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 29-Dec-2020 10:42:05

782 Views

In this tutorial, we are going to learn how to write a program for union and intersection of two unsorted arrays. Let's see an example.Input arr_one = [1, 2, 3, 4, 5] arr_two = [3, 4, 5, 6, 7]Output union: 1 2 3 4 5 6 7 intersection: 3 4 5Let's see ... Read More

Find two numbers with sum and product both same as N in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 29-Dec-2020 10:38:11

234 Views

In this tutorial, we are going to write a program to find two numbers where x + y = n and x * y = n. Sometimes it's not possible to find those types of numbers. We'll print None if there are no such numbers. Let's get started.The given numbers are ... Read More

Find time taken for signal to reach all positions in a string - C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 29-Dec-2020 10:30:07

139 Views

In this tutorial, we are going to write a program that computes the time taken for a signal to reach all positions in a string. Let me explain it with an example.We will have a string that contains only s and p characters. s is a signal and p is ... Read More

Find three integers less than or equal to N such that their LCM is maximum - C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 29-Dec-2020 10:27:54

490 Views

In this tutorial, we are going to write a program that is based on the concepts of LCM. As the title says, we have to find three numbers that are less than or equal to the given number whose LCM is maximum.Let's see an example.Before diving into the problem let's ... Read More

Python - Inserting item in sorted list maintaining order

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 19:17:11

8K+ Views

In this article, we are going to learn how to insert an item in a sorted list maintaining the order. Python has a built-in module called bisect that helps us to insert any element in an appropriate position in the list.Follow the below steps to write the code.Import the module ... Read More

Python - Intersect two dictionaries through keys

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 19:13:25

2K+ Views

In this article, we are going to learn how to intersect two dictionaries using keys. We have to create a new dictionary with common keys. Let's see an example.Input: dict_1 = {'A': 1, 'B': 2, 'C': 3} dict_2 = {'A': 1, 'C': 4, 'D': 5} Output: {'A': 1, 'C': ... Read More

Python - Intersection of multiple lists

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 19:08:20

1K+ Views

In this article, we are going to see how to intersect two lists that contain multiple lists in different ways. Let's start in the traditional way.Follow the below the steps to solve the problemInitialize two lists with multiple listsIterate over the first list and add the current item in the ... Read More

Python - Intersection of two String

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 19:02:25

4K+ Views

In this article, we are going to learn how to intersect two strings in different ways.Follow the below the steps to solve the problem.Initialize two strings and an empty string.Iterate over the first string and add the current character to the new string if it presents in the second string ... Read More

Python - Join tuple elements in a list

Hafeezul Kareem

Hafeezul Kareem

Updated on 13-Nov-2020 18:56:17

11K+ Views

In this article, we are going to learn how to join tuple elements in a list. It's a straightforward thing using join and map methods. Follow the below steps to complete the task.Initialize list with tuples that contain strings.Write a function called join_tuple_string that takes a tuple as arguments and ... Read More

Advertisements