Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
161 views

Boolean evaluation

Given a boolean expression consisting of the symbols 0 (false), 1 (true), & (AND), | (OR), and ^ (XOR), and a desired boolean result value result, implement a function to count the number of ways ...
Andrei Rost's user avatar
2 votes
1 answer
243 views

Finding possible combinations for n<7 with rust

I am trying to learn rust and as such have been redoing some of the challenges on project Rosalind. This one relates to the challenge Enumerating Gene Orders. ...
mega_creamery's user avatar
4 votes
1 answer
1k views

Generate possible combinations by range and length

I am learning Haskell and I implemented a recursive function that generates possible strings by length and array (e.g. ['a'..'z']): ...
Vlad Havriuk's user avatar
2 votes
1 answer
256 views

Time and Space Complexity of Leetcode Problem #31. Next Permutation

The question is as follows: Given a collection of distinct integers, return all possible permutations. Example: ...
ny_coder_dude's user avatar
7 votes
2 answers
6k views

Permutations with replacement in Python

Many a times, I've had the need to use a permutations with replacement function. So, I've written a function to do just that: ...
Sriv's user avatar
  • 2,800
7 votes
2 answers
1k views

Letter Combinations of a phone number using a Dictionary

Problem statement (online source) Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone ...
Shahin's user avatar
  • 103
11 votes
1 answer
176 views

Recursive code to generate a parametric sweep of input values

I generate a set of data based off every combination of inputs. The source range that's inputs requires headers to identify the parameters. In its present state I'm not content as it's not as ...
IvenBach's user avatar
  • 3,487
3 votes
2 answers
291 views

Fixed Content Necklace Generator

I wrote a class that generates combinatorial necklaces with fixed content as per Sawada: A fast algorithm to generate necklaces with fixed content. The class is instantiated with an input list that ...
Rek's user avatar
  • 33
4 votes
3 answers
553 views

Generate parentheses solution

I have coded a solution to build all valid permutations of parentheses. My code is below. I have a question on my code based on a comment by my PEP8 checker. It said that there was no need to ...
MrJoe's user avatar
  • 2,143
6 votes
1 answer
655 views

Best way to performance permutations

This has been my white whale for a while, the idea is convert all the symbols to the goal symbol using all the pieces. I did an algorithm like 5 years ago (now is lost) and reach lvl 48 but got stuck ...
Juan Carlos Oropeza's user avatar
5 votes
2 answers
1k views

Finding all possible letter combinations from an inputted phone number

Prompt: Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone ...
springathing's user avatar
4 votes
1 answer
4k views

Recursive implementation of power set in Python

I was doing a recursion problem called power set, and would like to get code review. Here's the problem. ...
NinjaG's user avatar
  • 2,559
3 votes
2 answers
2k views

Generate all combinations of length N through M

I've started learning programming and as matter of practice I've decided to make a program that will output all possible string combinations and put them in a file. I've manged to do that and it works ...
sptls's user avatar
  • 33
3 votes
1 answer
254 views

python magic square finder for arbitrary numbers

I wrote this code to get all possible magic squares that can be made with a list you put in. The only contraints are that the count of numbers is a square and that each number is unique. It even works ...
Tweakimp's user avatar
  • 779
8 votes
2 answers
7k views

A beautiful and easy way of permutation with recursion

I want to share a better version of permutation with you. Yesterday, when I was reading Horowitz's Fundamentals of Data Structures In C++, and I noticed that the result of the code, at page 32, in ...
RainningTW's user avatar

15 30 50 per page