All Questions
Tagged with programming-challenge python
1,039 questions
5
votes
3
answers
1k
views
Project Euler Problem #1: Multiples of 3 or 5
Project Euler Problem #1
Multiples of 3 or 5 states:
If we list all the natural numbers below 10 that are multiples of 3 or
5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of ...
5
votes
2
answers
194
views
LeetCode Number 416: Partition Equal Subset Sum
Problem: MLE
I am confused as to why the LeetCode judge reports Memory Limit Exceeded when my solution looks close to the editorial solution. I not too familiar with ...
7
votes
4
answers
961
views
Project Euler #54: class for poker hands
I'm working right now on Project Euler problem 54, and I figured that this was the perfect opportunity to try to work with classes. This is my first time, so I'm sure that there are a lot of style, ...
6
votes
2
answers
255
views
(HackerRank) Project Euler+ #250: 250250
Link to problem: linkNumber of solvers: 27 out of 844Solve rate (per person): 3.199%Success rate (over all submissions): 1.78%
Project Euler+ on HackerRank is basically supposed to be a generalization ...
8
votes
5
answers
1k
views
LeetCode 977: Squares of a sorted array, maintaining non-decreasing order
I tried solving the LeetCode question like many others, trying to incorporate the O(n) time complexity requirement.
Squares of a Sorted Array
Given an integer array ...
11
votes
4
answers
2k
views
Leetcode 93: Restore IP Addresses
(Source: Leetcode 93: Restore IP Addresses [Medium])(Topics: [String] [Backtracking])
The problem is as follows:
Definition: A valid IP address is defined to consist of exactly four integers ...
6
votes
5
answers
858
views
Bracket matching - Advent of Code 2021 Day 10
The following code solves Advent Of Code 2021 Day 10.
The goal for this time around is evaluating whether a line of brackets
is complete, has a syntax error or is missing some closing brackets.
...
4
votes
1
answer
142
views
Efficient polynomial multiplication in Python
I'm practicing problems for the ICPC competition, and one of the problems requires solving it by using an FFT to compute the product of two polynomials efficiently. Since this is for the ICPC ...
1
vote
1
answer
109
views
Finding the number of distinct decompositions a number has using only repdigits
This is a problem from a previous semester that I am trying to upsolve. I am trying to solve a problem involving the total number of ways of decomposing a number using only repdigits. A repdigit is a ...
6
votes
3
answers
895
views
Project Euler 127 - abc-hits
Problem (Rephrased from here):
The radical of \$n\$, \$rad(n)\$, is the product of distinct prime factors of \$n\$. For example, \$504 = 2^3 × 3^2 × 7\$, so \$rad(504) = 2 × 3 × 7 = 42\$.
We shall ...
2
votes
1
answer
57
views
Optimal Extraction of Longest Sorted Sequence from Individually Sorted Bucket Arrays Without Repetitions
Consider a bucket array containing sorted and/or empty buckets, and the goal is to extract the longest possible sequence in sorted order, under the following conditions:
Only one element in each ...
6
votes
1
answer
277
views
Performance Tuning to enable answer for Project Euler #566 "Cake Icing Puzzle"
Related to this question I am still looking for a solution to Project Euler Problem 566 (see link for a nice simulation also):
Adam plays the following game with his birthday cake.
He cuts a piece ...
5
votes
2
answers
362
views
Coding challenge for mixing a string
Challenge at https://www.codewars.com/kata/5629db57620258aa9d000014/train/python
Given two strings s1 and s2, we want to visualize how different the
two strings are. We will only take into account ...
2
votes
3
answers
573
views
Extract data from poorly formatted phonebook
The Problem
John keeps a backup of his old personal phone book as a text file. On
each line of the file he can find the phone number (formated as
+X-abc-def-ghij where X stands for one or two digits),...
4
votes
1
answer
156
views
Longest spell to cast from pages of spellbook follow-up
This question is from the PCTC 2022 R2 Past Paper and is a follow-up on my previous question. Previous question
I have implemented several solutions suggested, such as creating an array with pages ...