All Questions
8 questions
6
votes
1
answer
352
views
Codeforces: D2. Counting Is Fun (Hard Version)
The code works okay for the following problem.
Problem
An array 𝑏 of 𝑚 non-negative integers is said to be good if all the elements of 𝑏 can be made equal to 0 using the following operation some (...
5
votes
1
answer
356
views
Total number of non overlapping subsets
I am trying to solve this question. The essence of the problem is this:
Given a list of school classes with start and end times, find the total number of non-overlapping subsets.
I've written up a ...
3
votes
0
answers
58
views
Number of ways to complete a plan
I worked on a dynamic programming problem. Here is its link. I have to find the number of ways respecting the constraint that user doesn't go to the Gym for two consecutive days.
...
3
votes
1
answer
118
views
Given two words, transform the first one into the second [closed]
As the title says, the problem I had to do sounded something like this:
We are given two words, S1 and S2. We must transform S1 into S2, using the following operations:
insert: insert a character in ...
8
votes
6
answers
2k
views
Yet another Fibonacci number generator
First attempt at dynamic programming. I want to make this run faster and better.
fibonacci.cpp
...
3
votes
1
answer
2k
views
Calculate possible balances in piggy-bank by weight
I have solved Piggy-Bank problem on SPOJ using dynamic programming.
The question asks you to get the minimum value that is possible with given weight (\$w\$) and one or more coins (\$n\$) with given ...
11
votes
3
answers
2k
views
Substitution cipher algorithm performance boost
This algorithm is meant to read a string of numbers on an input, a naive substitution cipher code (A = 1, B = 2, ..., Z = 26) and output the number of ways the code could be interpreted (e.g. 25114 ...
2
votes
2
answers
482
views
Calculating the number of prime numbers to solve the puzzle
How can the following program execution time improved? I have used dynamic programming in both "recursive" as well as "prime" function, but I'm not getting the efficient execution time.
There is a ...