Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
0 answers
95 views

Iterating through every permutation of every subset [closed]

I have this code which I use to iterate through every permutation of every subset in an array witch holds integers. One big problem is the efficiency of course, another problem is the fact that if I ...
xM0nSt3r's user avatar
1 vote
1 answer
2k views

Create all combinations of length N from a given alphabet

I have some (very limited) experience in Java 6 and decided to revisit the language. To do so I wrote a solution for the following challenge: You are given a number N and a string S. Print all of the ...
yuri's user avatar
  • 4,518
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. ...
CodeHunter's user avatar
1 vote
1 answer
131 views

Producing residues of combinatorics on strings

Basically, this code does multiplication of chosen operations. ...
user avatar
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 ...
lightning_missile's user avatar
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 ...
user avatar
2 votes
1 answer
706 views

3D bin packing in Java

I made some changes to the first code here I wrote and I want to know which one is more correct logically (before the changes or after the changes). It's really hard to manually test these kind of ...
Rii933's user avatar
  • 75
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 ...
Rii933's user avatar
  • 75
16 votes
1 answer
210 views

Minesweeper analyze goes to N-Queensland

As @rolfl recently solved the N-Queens problem, I figured that it was time also for me to solve it. My approach is significantly different from @rolfl's. I quickly realized that the N-Queens problem ...
Simon Forsberg's user avatar
4 votes
2 answers
1k views

Print all permutations with some constraints

I've the following problem: Print all valid phone numbers of length n subject to following constraints: 1.If a number contains a 4, it should start with 4 2.No two consecutive ...
Margo Eastham's user avatar
9 votes
2 answers
789 views

Optimizing String combinations in Java

I need to obtain all combinations of a String of length k from the given elements. For example, for ...
user1418018's user avatar
11 votes
2 answers
585 views

A Specific Combination

This code is going to be included in my Minesweeper Probabilities project. (so far it only exists on the develop-branch) The purpose is to return a specific combination, let's say for example that ...
Simon Forsberg's user avatar
62 votes
3 answers
4k views

Analyzing Minesweeper Probabilities

Calculating probabilities in Minesweeper might sound like an easy task, but I've seen so many probability calculators that's either incorrect, horribly slow, or with ugly code (or all of them) so I ...
Simon Forsberg's user avatar
1 vote
1 answer
117 views

Find triangles from line

I have some lines that form triangles. I'd like to challenge the fastest way to find all triangles. In particular the code should take an ArrayList of Line2D object and return an ArrayList of ...
nkint's user avatar
  • 528
8 votes
1 answer
2k views

Speeding up subset sum implementation

Important fact: the number of the input is greater than 1. How do I use this fact to speed up this solution? ...
user3527406's user avatar

15 30 50 per page