Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
5 votes
3 answers
6k views

Generating all possible combinations of a string using iteration

I am generating all possible combinations from a string concatenated. I have a \$O(n*2^n)\$ solution. ...
Gary In's user avatar
  • 153
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
842 views

Efficient String permutations calculation in Java

In trying to compute permutations of a given String, what can I do to further improve the code below for memory and/or time efficiency? ...
Anonymous Human's user avatar
2 votes
1 answer
2k views

Iterative solution for generating all permutations of a string

I know the runtime for generating all permutations is supposed to be \$O(n!)\$. I'm not sure if the code I wrote for it runs in \$O(n!)\$ though. I'm having trouble analyzing its runtime. The ...
fluffychaos's user avatar
3 votes
3 answers
602 views

Searching a string for any permutation of words

Given a string and an array of words, return all indexes in string for which a concatenation of all words in the array, in any order (so ["eensie", "weensy", "spider"] has six orderings) can be ...
user avatar
3 votes
2 answers
3k views

Non-Contiguous Substrings

Problem: A non-contiguous substring of string \$s\$ is a sequence of \$k \geq 0\$ characters in \$s\$, in the order in which they occur in \$s\$. For instance, the set of all non-contiguous ...
francium's user avatar
  • 139
1 vote
1 answer
454 views

Permutations of a string

I wrote the following code to permute the characters of a string assuming there is no repeated character. I also want to make sure the space complexity of this algorithm is \$O(n*n!)\$: There are \$...
giulio's user avatar
  • 743
3 votes
3 answers
10k views

Permutation of a string eliminating duplicates

This code lists the permutations of the string, and eliminates duplicates if any. I'm looking for code review, best practices, optimizations etc. I'm also verifying complexity: \$O(n! * n)\$ as time ...
JavaDeveloper's user avatar
3 votes
2 answers
199 views

Determine if a word can be constructed from list of subsets - follow-up

I have reworked my code as suggested from my previous question: Determine if a word can be constructed from list of subsets. Please instruct me on the complexity along with a review feedback, as ...
JavaDeveloper's user avatar
2 votes
2 answers
199 views

Determine if a word can be constructed from list of subsets [closed]

The question is explained well by examples in the comments below. Also I request verifying complexity: O( n * n!), where n is the number of words in the subsets. Review my code for optimizations, ...
JavaDeveloper's user avatar