All Questions
30 questions
1
vote
1
answer
133
views
Subset Product Algorithm
Subset Product is an NP-complete problem and is my favorite problem. So, I've written a slightly smarter way of solving the problem.
Will performance impact matter if I use multi-cpus and my GPU?
Do ...
6
votes
1
answer
608
views
Combinatorics, C++ and optimization
Note: I have a working solution, my question is about optimization and other approaches.
Problem Description
Hello, I'm re-writing an old program I made that solves nonograms.
As part of solving it, I ...
4
votes
1
answer
107
views
Filter out unwanted substrings while generating all possible relevant substrings
Write a Program that determines where to add periods to a decimal string so that
the resulting string is a valid IP address. There may be more than one valid IP address
corresponding to a string, ...
8
votes
3
answers
326
views
Refactor the code which performs "cross-product", "reduce", "product of list" and "sum of list"
I have come up with a sequence of steps to find the maximum product of y positive numbers which add up to x. But the program is ...
7
votes
2
answers
3k
views
Sums of all sublists
The parts_sums function in the code takes a list as parameter and then returns sum of all sub-lists present in the list. e.g.
if, ...
5
votes
1
answer
2k
views
Project Euler 76: Counting summations
Project Euler Problem 76 asks:
How many different ways can one hundred be written as a sum of at least two positive integers?
My code is correct but just works slowly.
...
6
votes
1
answer
655
views
Best way to performance permutations
This has been my white whale for a while, the idea is convert all the symbols to the goal symbol using all the pieces.
I did an algorithm like 5 years ago (now is lost) and reach lvl 48 but got stuck ...
1
vote
1
answer
179
views
Find all combinations of a number sequence which is first increasing then decreasing
Given an integer N(Natural Number), A program/Algorithm to find the
remainder of arrangements that can be obtained by rearranging the
numbers 1, 2, ...., N.
Input Format: One line containing ...
0
votes
1
answer
436
views
Produce the nth lexicographic permutation of a string consisting of letters H and V
I have tried many possible methods here but I am still not able to reduce the time complexity of below algorithm.
...
9
votes
2
answers
1k
views
Return all valid expressions with specific target
The problem is stated as: Given a string that contains only digits 0-9 and a target value, return all expressions that are created by adding some binary operators (+, -, or *) between the digits so ...
1
vote
1
answer
131
views
Producing residues of combinatorics on strings
Basically, this code does multiplication of chosen operations.
...
2
votes
1
answer
997
views
Generating all unique permutations of a string
Here is a plan for generating the permutations of S: For each item x
in S, recursively generate the sequence of permutations of S - x, and
adjoin x to the front of each one. This yields, for each ...
1
vote
1
answer
1k
views
Using brute force to do large scale permutations and combinations
This problem should self explanatory based on namings of variables and functions. In essence I am doing well over 720*720*90 checks/calculations. Hence, this is taking far, far too long. How do I make ...
4
votes
2
answers
2k
views
3D bin packing algorithm using Java?
I wrote a 3D bin packing algorithm but I am still not sure if it is correct or not.
I did not follow any code or pseudo-code that's why I would like to know if it is an efficient algorithm for the 3D ...
20
votes
2
answers
2k
views
Calculate all possible distributions of n objects to k containers
Let's say I have \$5\$ apples, thus \$n = 5\$. I have three bags (\$k = 3\$), each having the capacities of \$4\$, \$4\$ and \$2\$:
$$c = { \{4, 4, 2 \}}$$
I'd like to calculate the number of ways ...