combinatorics
Google Interview: Arrangement of Blocks
You are given N blocks of height 1…N. In how many ways can you arrange these blocks in a row such that when viewed from left you see only L blocks (rest are hidden by taller blocks) and when seen fro[详细]
2023-04-11 07:27 分类:问答Distribution of balls into 'bins with given capacities' using Dynamic Programming
I was wondering how to solve such a problem using DP. Given n balls and开发者_JAVA技巧 m bins, each bin having max. capacity c1, c2,...cm. What is the total number of ways of distributing these n bal[详细]
2023-04-10 16:09 分类:问答enumerating all possible strings of length K from an alphabet in Python [duplicate]
This question already has answers here: Closed 11 years ago. Possible Duplicate: is there any best way to generate all possible three letters keywords[详细]
2023-04-08 20:51 分类:问答All permutations with repetition using scala
I am looking for the scala way to give all permutations without repetitions. I know there are some postings on this site already but they seem to have a slightly different problem.[详细]
2023-04-05 18:07 分类:问答Given a N-digit base 3 number, generate all base 3 N-digit numbers that have k digits different in parallelizable way
To solve my problem it is natural to use base 3 numbers. I have several tables indexed by base 3 numbers, and at some point I need to go through all the indexes that differ in k digits from a given N-[详细]
2023-04-04 07:01 分类:问答Find all subsets of size N in an array using Ruby
Given an array [\'a\', \'b\', \'c\', \'d\', \'e\',开发者_开发问答 \'f\'], how would I get a list of all subsets containing two, three, and four elements?[详细]
2023-04-03 11:57 分类:问答Variations with repetition [duplicate]
This question already has answers here: How to get the Cartesian product of multiple lists (18 answers)[详细]
2023-04-03 10:47 分类:问答Static sized permutations from Dynamic sized set
How can I obtain all combinations for a list where combination size need only be static eg. if the list has 4 elements then it will only need permutations of length 4 not 3, 2 and 1. I\'m guessing thi[详细]
2023-04-02 03:57 分类:问答Shuffle list, ensuring that no item remains in same position
I want to shuffle a list of unique items, but not do an entirely random shuffle. I need to be sure that no element in the shuffled list is at the same position as in the original list. Thus, if the or[详细]
2023-04-01 18:30 分类:问答Every possible combination
How can I obtain every possible combination for a dynamic sized set? can it be done without recursion or methods? I\'ve been trying to figure ou开发者_JAVA技巧t how to do it with just loops for the pa[详细]
2023-04-01 18:29 分类:问答