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
2 votes
1 answer
252 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 ...
Prateek Thapa's user avatar
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 ...
Chau Giang's user avatar
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: ...
thadeuszlay's user avatar
  • 4,003
2 votes
2 answers
131 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 ...
j_d's user avatar
  • 171
3 votes
2 answers
911 views

Heap's algorithm implementation - permutations

I wrote an implementation of Heap's permutation algorithm in JavaScript (ES2015): ...
bartsmykla'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
17 votes
5 answers
53k views

Brute force password cracker

I wrote this script for a proof of concept JavaScript password cracker: ...
Progo's user avatar
  • 313
5 votes
2 answers
182 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 ...
Juliano's user avatar
  • 238
2 votes
1 answer
186 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 ...
rahmu's user avatar
  • 516