Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
2 answers
185 views

Map coloring algorithm functional implementation in python

I'm an autodidact working on map coloring algorithms with backtracking, see chapter 2 of this book. I tested this implementation with success but I'm still unsure whether it is tricking me somewhere, ...
deppep's user avatar
  • 33
1 vote
2 answers
628 views

Removing Elements from an Array Based on a Second Array

I've written a function that takes two arrays of integers as input and removes all the elements in the first array that are also present in the second array. I would like to share my code with you and ...
TAHER El Mehdi's user avatar
1 vote
1 answer
62 views

Optimizing the Dig Pow function

I have written a Python function to solve the Dig Pow problem, where the goal is to find a number k such that the sum of each digit of n raised to a specific and ...
TAHER El Mehdi's user avatar
7 votes
5 answers
1k views

Optimizing a function to find the closest multiple of 10

I have written a Python function called closest_multiple_10() which takes an integer as input and returns the closest multiple of 10. The function works as expected,...
TAHER El Mehdi's user avatar
1 vote
1 answer
943 views

Python implementation of Quicksort using list comprehensions

I wrote an implementation of quicksort that I think is pythonic. I based it off of this common Haskell implementation: ...
Bret Fontecchio's user avatar
3 votes
1 answer
1k views

Functional Scrabble Word Score

Homework: Write a function to score a scrabble word. values is a global dict formatted as values = {'a': 1, 'b': 3,...} The ...
nexus_2006's user avatar
6 votes
4 answers
4k views

Mastermind: Evaluating the guess

The evaluate_guess function below returns the evaluation of a guess with respect to Mastermind game rules: ...
blackened's user avatar
  • 361
1 vote
2 answers
7k views

Functional prime factor generator

I have this prime factor generator for some number n. It returns list of all prime factors. In other words, product of the list equals ...
Mirzhan Irkegulov's user avatar