Arnab Chakraborty has Published 4452 Articles

C++ program to create one rectangle class and calculate its area

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 08:32:01

23K+ Views

Suppose we have taken length and breadth of two rectangles, and we want to calculate their area using class. So we can make a class called Rectangle with two attributes l and b for length and breadth respectively. And define another function called area() to calculate area of that rectangle.So, ... Read More

C++ program to test inheritance through triangle class

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 08:29:55

340 Views

Suppose we want to make one Triangle class and another child class called Isosceles. The triangle class has a function that prints that the object is of type triangle, and Isosceles has two functions to show that it is an isosceles triangle and one description. We also need to call ... Read More

C++ program to store student roll and name using map STL

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 08:27:18

851 Views

Suppose we have a map data structure for students roll and name the roll is an integer data and name is string type data. In our standard input we provide n queries. In each query (in each line) there must be two elements and for type 1 query there are ... Read More

C++ program to insert delete and find from set STL

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 08:24:11

430 Views

Suppose we have a set data structure for integer type data. In our standard input we provide n queries. In each query (in each line) we have two elements. First one is the operator, second one is the element. The operations are like below −Insert. This will insert the element ... Read More

C++ Program to remove items from a given vector

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 08:21:08

10K+ Views

Suppose we have a set of elements present inside a vector. We shall have to perform some remove operation using erase() function of vector class type to remove using indices, and finally display rest of elements. The erase function does not take the index directly. We shall have to pass ... Read More

Program to find maximum XOR with an element from array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 08:15:55

226 Views

Suppose we have an array called nums with non-negative values. We also have another array called queries where queries[i] has a pair (xi, mi). The answer of ith query is the maximum bitwise XOR value of xi and any element of nums that less than or equal to mi. If ... Read More

Program to find minimum adjacent swaps for K consecutive ones in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 08:12:07

304 Views

Suppose we have one binary array nums, and a value k. In one move, we can select two adjacent indices and swap their values. We have to find the minimum number of moves required so that nums has k consecutive 1's.So, if the input is like nums = [1, 0, ... Read More

C++ program to create boxes and calculate volume and check using less than operator

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 08:08:29

2K+ Views

Suppose we shall have to define a box class with few conditions. These are as follows −There are three attributes l, b and h for length, breadth and height respectively, (these are private variables)Define one non-parameterized constructor to set l, b, h to 0, and one parameterized constructor to set ... Read More

Program to check existence of edge length limited paths in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 08:07:53

122 Views

Suppose we have one undirected weighted graph with n nodes using one edgeList, where edgeList[i] has three parameters (u, v, w) denotes there is a path from u to v whose distance is w. We also have another query array where query[i] has (p, q, lim). This query is trying ... Read More

Program to minimize deviation in array in Python

Arnab Chakraborty

Arnab Chakraborty

Updated on 07-Oct-2021 07:54:25

451 Views

Suppose we have an array nums. We can perform two types of operations on any element of the array any number of timesFor even elements, divide it by 2For odd elements, multiply it by 2.Now the deviation of the array is the maximum difference between any two elements in the ... Read More

Advertisements