Integrate a Laguerre Series and Set the Order of Integration in Python

AmitDiwan
Updated on 03-Mar-2022 04:50:20

180 Views

To integrate a Laguerre series, use the laguerre.lagint() method in Python. The method returns the Laguerre series coefficients c integrated m times from lbnd along axis. At each iteration the resulting series is multiplied by scl and an integration constant, k, is added. The scaling factor is for use in a linear change of variable.The 1st parameter, c is an array of Laguerre series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index. The 2nd parameter, m is an order of integration, must be positive. (Default: ... Read More

Find Number of Sides of a Polygon Inside a Grid using C++

Arnab Chakraborty
Updated on 02-Mar-2022 12:55:32

491 Views

Suppose, we are given a grid of dimensions h x w. There are two types of cells in the grid, white and black cells. White cells are represented by '.', whereas black cells are represented by '#'. Now the grid has multiple black cells in it that form a polygon. We have to find out the number of sides that the polygon has. It is to be noted, that the outermost cells of the grid are always white.So, if the input is like h = 4, w = 4, grid = {"....", ".##.", ".##.", "...."}, then the output will be ... Read More

Moves to Read a Point from Another Point in a 2D Plane in C++

Arnab Chakraborty
Updated on 02-Mar-2022 12:40:34

331 Views

Suppose, there are two points in a 2D plane a and b that have the coordinates (x1, y1) and (x2, y2) respectively. Currently, we are at point 'a' and we can move at a distance of 1 either vertically or horizontally. We move to point b from point a, then get back to point a, and we go to point b again. It is not allowed to move through the same points more than once except the points a and b. We have to find out the moves we will make in this whole trip, and output it. If we ... Read More

Minimum Operations Required to Defeat an Enemy in C++

Arnab Chakraborty
Updated on 02-Mar-2022 12:39:00

427 Views

Suppose, we are playing a video game where the protagonist uses knives to defeat his enemies. The protagonist can use the knife for slashing the enemy or he can throw it towards the enemy. If the protagonist throws a knife, that cannot be retrieved again. The damage dealt by knife i is given in the array 'knives' where each element is of the form {slash, throw}. 'Slash' means the damage done to an enemy by slashing them with that knife and 'throw' means damage done to them by throwing that particular knife. Slashing can be done unlimited times, but a ... Read More

Find Number of Changes in a Grid using C++

Arnab Chakraborty
Updated on 02-Mar-2022 12:37:34

202 Views

Suppose, we are given a grid of dimensions x * y that contains two types of cells, blocked and unblocked. Blocked cells mean that the cells aren't accessible and unblocked means that the cells are accessible. We represent the grid in a 2D array where the blocked cells are given as '#' and the unblocked cells are given as '.'. Now, we have to reach from the cell (0, 0) to cell (x, y). We can perform only two moves, we can either go right of a cell or go down from a cell. We have to keep in mind ... Read More

Find Least Amount of Money for OTT Services in C++

Arnab Chakraborty
Updated on 02-Mar-2022 12:35:09

221 Views

Suppose, a telecom operator has introduced a service called "all-in-one" which provides access to n OTT content providers at a fixed price of k dollars. Now, if we have to subscribe to the OTT platforms directly, we have to pay an individual amount of fee to each of the platforms. We do not need subscriptions to every platform at all months, so we have to find a way to cost-effectively use their services. The starting month in which we need the service of platform i is given in the array start_month and the ending month is given in the array ... Read More

Find Minimum Locations to Place Bombs to Kill All Monsters in C++

Arnab Chakraborty
Updated on 02-Mar-2022 12:26:48

325 Views

Suppose we have two arrays X and H. Both are with N elements, also have another two numbers D and A. Consider in a story, a silver fox is fighting with N monsters. The monsters are standing in a row, coordinate of ith monster is X[i], and its health is H[i]. Silver fox can use bombs to attack monsters. Dropping bomb at location x will damage all monsters within the range of x - D to x + D. Their health will be reduced by A. When all monsters have 0 health left, then the fox wins. We have to ... Read More

Find Required Score to Achieve Target in C++

Arnab Chakraborty
Updated on 02-Mar-2022 12:24:07

310 Views

Suppose we have two arrays p and c both are with D number of elements each, and another number G. Consider in a coding contest, each problem has its score based on difficulty. The problem p[i] has score 100i. These p[1] + ... + p[D] problems are all of the problems present in the contest. a user in the coding site has a number total_score. The total_score of an user is the sum of the following two elements.Base score: the sum of score of all solved problemsBonus: when a user solves all problems with a score of 100i, he or ... Read More

Count Maximum Possible Division in a Graph with Given Condition in C++

Arnab Chakraborty
Updated on 02-Mar-2022 12:21:17

175 Views

Suppose we have an adjacency matrix of a graph G. We have to check whether we can divide the vertices into non-empty sets V1, ... Vk, such that: every edge connects two vertices belonging to two adjacent sets. If the answer is yes, we have to find the maximum possible value of sets k, in such division.So, if the input is like010110101001010100101000100000010000then the output will be 4StepsTo solve this, we will follow these steps −Define an array dp of size: 210. n := size of matrix fl := 1 ans := 0 for initialize i := 0, when i < ... Read More

Find Maximum Possible Smallest Time Gap Between Two Clock Readings in C++

Arnab Chakraborty
Updated on 02-Mar-2022 11:27:24

201 Views

Suppose we have an array D with N elements. Consider in a code festival there are N+1 participants including Amal. Amal checked and found that the time gap between the local times in his city and the i-th person's city was D[i] hours. The time gap between two cities: For any two cities A and B, if the local time in city B is d o'clock at the moment when the local time in city A is 0 o'clock, then the time gap between these two cities is minimum of d and 24−d hours.Here, we are using 24-hour notation. Then, ... Read More

Advertisements