Articles on Trending Technologies

Technical articles with clear explanations and examples

Check if the given number K is enough to reach the end of an array in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 205 Views

Suppose we have an array nums and another value k. We have to check whether it is possible to reach the end of the array by performing these operations or not Operation: Traverse nums and, if any non-prime value is there then decrement the value of k by 1. Now if any value is prime then refill the value of k to its initial value.So, if the input is like nums = [8, 5, 6, 7, 8], k = 2, then the output will be True as nums[0] is not prime, then make k = 1, then nums[1] is prime ...

Read More

What is the use of pheatmap function in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 162 Views

The pheatmap function is used to create clustered heatmaps but we can change the aesthetics of the plot by using color argument which is one of the main functionalities of pheatmap function. There are many other arguments that differentiate pheatmap from heatmap function.Examplelibrary(pheatmap) M1

Read More

Check whether given circle resides in boundary maintained by two other circles in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 205 Views

Suppose we have two radius values r1 and r2 of two concentric circles. We have another input coordinate coord and a radius value r. We have to check whether the circle whose center is placed at coord and it fits inside the boundary of two given concentric circles.So, if the input is like r1 = 4 r2 = 2 coord = (3, 0) r = 1, then the output will be True.To solve this, we will follow these steps −val := square root of(x^2 + y^2)if val + r = r1 - r2, thenreturn Truereturn FalseLet us see the following ...

Read More

How to create a plot in base R without margins?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 704 Views

To create a plot without margins, we first need to define that margin in a way that the plot created after that will not have margins and this can be done by using par function. We would need to pass mar function within par function as par(mar=c(0,0,0,0)).Examplepar(mar=c(0,0,0,0)) plot(1:10)OutputExamplebarplot(1:10)Output

Read More

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

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 620 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 see what LCM is and write program for it.LCM is the least common multiple of a number. It is also known as Least common divisor. For two positive number a and b, the LCM is the smallest integer that is evenly divisible by both a and b.If the given integers ...

Read More

Check whether given degrees of vertices represent a Graph or Tree in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 268 Views

Suppose we have a list of degrees of some vertices. We have to check whether it is forming graph or tree.So, if the input is like deg = [2,2,3,1,1,1], then the output will be TreeTo solve this, we will follow these steps −vert := number of verticesdeg_sum := sum of all degree values of all verticesif 2*(vert-1) is same as deg_sum, thenreturn 'Tree'return 'Graph'Let us see the following implementation to get better understanding −Example Codedef solve(deg):    vert = len(deg)    deg_sum = sum(deg)          if 2*(vert-1) == deg_sum:       return 'Tree'    return 'Graph' deg = [2,2,3,1,1,1] print(solve(deg))Input[2,2,3,1,1,1] OutputTree

Read More

How to create a plot of Poisson distribution in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 3K+ Views

The Poisson distribution is a discrete distribution that has only one parameter named as lambda and it is the rate parameter. The rate parameter is defined as the number of events that occur in a fixed time interval. To create a plot of Poisson distribution in R, we can use the plot function with the density of the Poisson distribution using dpois function.Exampleplot(dpois(x=1:50,lambda=3))OutputExampleplot(dpois(x=1:50,lambda=3),type="l")OutputExampleplot(dpois(x=1:50,lambda=3),type="b")Output

Read More

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

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 184 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 a position in the string. A signal starts at s and travels in both left and right directions. We are assuming it takes one unit of time to travel to the next position in the string. Our task is to compute the time needed to convert all positions into signals.Let's ...

Read More

Check whether given floating point number is even or odd in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 1K+ Views

Suppose we have a floating point number; we have to check whether the number is odd or even. In general, for integer it is easy by dividing the last digit by 2. But for floating point number it is not straight forward like that. We cannot divide last digit by 2 to check if it is odd or even.So, if the input is like n = 200.290, then the output will be Odd though the last digit is divisible by 2.To solve this, we will follow these steps −s := convert number as stringflag := Falsefor i in range size ...

Read More

How to create a matrix without column and row indices in R?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 11-Mar-2026 619 Views

To create a matrix without column and row indices, we first need to create the matrix and then prmatrix function can be used to convert that matrix without column and row indices but we would need to provide the number of rows inside the function. For example, if we have a matrix M that contains 5 rows and 5 columns then it can be converted to a matrix without column and row indices using prmatrix(M,rowlab=rep("",5),collab=rep("",5)).ExampleM1

Read More
Showing 2951–2960 of 61,248 articles
« Prev 1 294 295 296 297 298 6125 Next »
Advertisements