Nizamuddin Siddiqui

Nizamuddin Siddiqui

1,958 Articles Published

Articles by Nizamuddin Siddiqui

Page 11 of 196

How to get all the combinations of the keypad value in a mobile by backtracking using C#?

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

The problem can be broken down into smaller and simple "subproblems", which can be further divided into yet simpler and smaller subproblems. We take each and every digit one by one and count all ndigits reachable from any digit, use a map to store the mapping of digits reachable from every digit. When the digit becomes n-digit, update the count.Exampleusing System; using System.Collections.Generic; namespace ConsoleApplication{    public class BackTracking{       private string GetKeyPadValueBasedOnInput(string digit){          Dictionary keypad = new Dictionary();          keypad.Add("2", "abc");          keypad.Add("3", "def");       ...

Read More

How to convert ggplot2 graph into a plotly graph in R?

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

To convert ggplot2 graph into a plotly graph in R, we can follow the below steps −First of all, create a data frame.Then, create a ggplot2 graph and save it in an object.After that, load plotly package and create the ggplot2 graph using ggplotly function.Create the data frameLet's create a data frame as shown below −x

Read More

How to find the target sum from the given array by backtracking using C#?

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

Target sum problem is the problem of finding a subset such that the sum of elements equal a given number. The backtracking approach generates all permutations in the worst case but in general, performs better than the recursive approach towards subset sum problem.A subset A of n positive integers and a value sum is given, find whether or not there exists any subset of the given set, the sum of whose elements is equal to the given value of sumSuppose we have an array [1, 2, 3] the output will be “1, 1, 1, 1 “, “1, 1, 2”, ”2, ...

Read More

How to find the distinct subsets from a given array by backtracking using C#?

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

Distinct subsets problem gives us the different combination from the given array.When the target is 2 then from the array, we take all the combination that corresponds to number 2, When the target is three then from the array, we take all the combination that corresponds to count 3. In the below example the array is [1, 2, 3] and the target is 2. So, we take all the combinations the corresponds to number 2 “1, 2 “, “2, 3”, ”1, 3””.Exampleusing System; using System.Collections.Generic; using System.Text; using System.Linq; namespace ConsoleApplication{    public class BackTracking{       public void ...

Read More

How to generate the outcome of three throws of a die in R?

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

When we roll a die three times, the sample space contains two hundred and sixteen outcomes that is 216. If we want to generate the outcome of three throws of a die then expand.grid function can be used with rep and list function.Generating the outcome of three throws of a dieLet's create a data frame as shown below −expand.grid(rep(list(1:6),2))On executing, the above script generates the below output(this output will vary on your system due to randomization) −OutputVar1 Var2 1 1    1 2 2    1 3 3    1 4 4    1 5 5    1 6 6    1 7 1    2 8 2    2 9 3    2 10 4    2 11 5    2 12 6    2 13 1    3 14 2    3 15 3    3 16 4    3 17 5    3 18 6    3 19 1    4 20 2    4 21 3    4 22 4    4 23 5    4 24 6    4 25 1    5 26 2    5 27 3    5 28 4    5 29 5    5 30 6    5 31 1    6 32 2    6 33 3    6 34 4    6 35 5    6 36 6    6

Read More

How to define the number of breaks in base R histogram?

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

To define the number of breaks in base R histogram, we can use breaks argument along with hist function.Create the histogram with small number of breaksUse a vector with normal distribution and the histogram of the same vector with ten breaks −x

Read More

How to find the unique combination k sum that corresponds to k sum using C#?

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

Create an output list to store the valid sequences, create a current list that will store the current sequence found in the path of the recursion tree. A backtrack function that will go into the recursion until the target is achieved, otherwise, it should backtrack to the previous phase as target becomes less than 0. At any point in time, if target becomes 0 then add the candidate array to the result as the values in the candidate array must be sum up to the given target.If those are not the cases then, one by one add the elements in ...

Read More

How to divide data frame rows by number of columns in R?

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

To divide data frame rows by number of columns in R, we can follow the below steps −First of all, create a data frame.Then, use apply function to divide the data frame rows by number of columns.Create the data frameLet's create a data frame as shown below −x

Read More

How to convert numeric levels of a factor into string in R data frame?

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

To convert numeric levels of a factor into string in R data frame, we can follow the below steps −First of all, consider an in-built data set or create new one.Then, use mutate function with ifelse to create string column based numeric column representing a factor.Consider an-inbuilt data setLet’s have a look at mtcars data set in base R −data(mtcars) head(mtcars, 25)On executing, the above script generates the below output(this output will vary on your system due to randomization) −Output                      mpg cyl disp hp drat wt qsec vs am gear ...

Read More

How to convert year, month, and day of the month into a complete date in R?

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

To convert year, month, and day of the month into a complete date, we can follow the below steps −Create a data frame with Year, Month and DayOfMonth as separate columns.Use mutate function of dplyr package to create complete date.Create the data frameLet's create a data frame as shown below −Year

Read More
Showing 101–110 of 1,958 articles
« Prev 1 9 10 11 12 13 196 Next »
Advertisements