All Questions
9 questions
2
votes
1
answer
243
views
In how many different ways can a group of 9 people be divided into 3 groups, with each group containing 3 people?
To divide 9 persons into 3 groups, when the ordering of groups is not important can be done in
(9C3 * 6C3 * 3C3) / (3!) = 280 ways
Here, we divide by (3!) because the ordering of 3 groups is not ...
2
votes
2
answers
1k
views
Generate all possible unique combinations of positive numbers these have sum equal to N
This is my function to generate all possible unique combinations of positive numbers these have sum equal to N.
For example:
If the input is 4
The output should ...
4
votes
1
answer
3k
views
Generate all possible combination of n-pair parentheses
The task is taken from LeetCode
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
...
2
votes
2
answers
130
views
Forming all multiples of 3 using the given digits
I'm working on this kata from Codewars. The task is:
Given a certain number, how many multiples of three could you obtain with its digits?
Supose that you have the number 362. The numbers that can be ...
3
votes
2
answers
907
views
Heap's algorithm implementation - permutations
I wrote an implementation of Heap's permutation algorithm in JavaScript (ES2015):
...
3
votes
3
answers
595
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 ...
17
votes
5
answers
53k
views
Brute force password cracker
I wrote this script for a proof of concept JavaScript password cracker:
...
5
votes
2
answers
177
views
Possible combinations following a rule
The problem is the following:
We have a number of months to buy a number of supplies. The sooner we finish buying them, the better, but we don't know how much we can buy per month and would like to ...
2
votes
1
answer
182
views
Counting the ways to pick increasing sequences from sorted arrays
Preamble
I am trying to learn JavaScript by writing code and looking up documentation, one problem at a time. I am already familiar with several "dynamic" languages, so I'm hoping to be productive ...