Articles on Trending Technologies

Technical articles with clear explanations and examples

Count numbers in range such that digits in it and it's product with q are unequal in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 236 Views

Given two numbers start and end as range variables and an integer q as input. The goal is to find the numbers within a range such that the number and its product with q have no common digits.If the number is 5 and q is 3 then the product will be 15. Both 5 and 15 have a common digit 5.If the number is 2 and q is 5 then the product will be 10. Both 2 and 10 have no common digit.Let us understand with examples.For ExampleInput -  start = 5, end = 10, q = 2Output - Count ...

Read More

How to check whether a particular word exists in an R data frame column?

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

If we have a character column in an R data frame then we might want to check whether a particular value exist in the column or not. For example, if we have a gender column then we might want to check whether transgender exists in that column or not. This can be done with the help of grepl function. Check out the below examples to understand how it works.Consider the below data frame −Examplex

Read More

Write a program in C++ to split two strings to make it a palindrome

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 11-Mar-2026 367 Views

A string is said to be a palindromic string if it remains the same after reversing it.In this particular problem, we've given two strings 'a' and 'b' of the same length. If they are split with some indexes, then the task is to check whether the sum of the strings makes a palindrome or not.Let's say we have two string 'a' and 'b' of length '4' and after splitting both the string at the index '3' such that,                  aaa | b  and bbb | aaaa (prefix of first string) + a(suffix of ...

Read More

Count Numbers in Range with difference between Sum of digits at even and odd positions as Prime in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 373 Views

Given two numbers start and end as range variables. The goal is to find the count of numbers that lie in this range [start, end] and have a difference of sum of digits at even and sum of digits at odd positions as Prime.That is (sum of digits at even position)-(sum of digits at odd position) = a Prime numberLet us understand with examples.For ExampleInput - start = 230, end = 270Output - Count of Numbers in Range with difference between Sum of digits at even and odd positions as Prime are: 6Explanation -  The number(s) between 230 to 270 ...

Read More

How to create the plot of a vector that contains missing values by adding the missing values in base R?

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

If there are missing values in a vector then the plot of such vector will not have all the values, only the non−missing values will be shown. If we want to create the plot by adding the missing values in the plot then we need to define the X−axis for the length of the vector and the Y−axis with the actual vector using cbind but missing values will be omitted as shown in the below example.Examplex

Read More

How to create combination of multiple vectors in R?

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

To create combination of multiple vectors, we can use expand.grid function. For example, if we have six vectors say x, y, z, a, b, and c then the combination of vectors can be created by using the command expand.grid(x,y,z,a,b,c).Examplex1

Read More

Symmetric Tree in C++

Dev Prakash Sharma
Dev Prakash Sharma
Updated on 11-Mar-2026 818 Views

Let us suppose we have a binary tree and the task is to check whether it constructs a symmetry of itself or not. A Symmetric Binary tree constructs the mirror image of itself.For ExampleInput-1:           Output:TrueExplanation:Since the given binary tree constructs the mirror image of itself, the output is True.Input-2: Output:FalseExplanation:Since the given binary tree doesn't make a mirror image of itself, it is not symmetric.Approach to Solve this ProblemA symmetric binary tree is a tree which is the mirror image of itself, which means we have to check whether the left and right nodes of the tree are ...

Read More

Count of a, b & c after n seconds for given reproduction rate in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 196 Views

Given three numbers 'a', 'b' and 'c' as input. The goal is to find the count/value of 'a', 'b' and 'c' after n seconds such that the rate of reproductions are:-Every a changes to b after every 2 secondsEvery b changes to c after every 5 secondsEvery c changes to 2 a after every 12 seconds.Let us understand with examples.For ExampleInput - n_seconds = 62  a = 1 b = 1 c = 1Output - Count of a after n seconds for given reproduction rate is: 0Count of b after n seconds for given reproduction rate is: 33Count of c after ...

Read More

How to create reverse of a number in R?

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

To create reverse of a number, we can use stri_reverse function of stringi package. For example, if we have a vector called x that contain some numbers then the reverse of these numbers will be generated by using the command stri_reverse(x). But the output will be in character form, if we want to have numeric values then as.numeric function can be used.library(stringi)Examplex1

Read More

Count of alphabets whose ASCII values can be formed with the digits of N in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 11-Mar-2026 334 Views

Given a long variable containing a positive number as input. The goal is to find the count of alphabets whose ASCII value digits are present in the digits of the number.Pick any two digits from the number and arrange them in a manner such that they form an ASCII value of English alphabets. ASCII values of A-Z start from 65 to 90 and ASCII values of a-z start from 97 to 122.Total numbers that are to be picked will be 26+26=52.Let us understand with examples.For ExampleInput -  N_digits = 163465Output - Count of alphabets whose ASCII values can be formed with ...

Read More
Showing 25491–25500 of 61,297 articles
Advertisements