Skip to main content

All Questions

5 votes
3 answers
855 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 ...
Nadav Nevo's user avatar
2 votes
1 answer
41 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 ...
M.A.'s user avatar
  • 121
3 votes
1 answer
152 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 ...
DuesserBaest's user avatar
5 votes
2 answers
338 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 ...
Vessel's user avatar
  • 133
2 votes
3 answers
564 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),...
Vessel's user avatar
  • 133
4 votes
1 answer
132 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 ...
helielicopter123's user avatar
6 votes
4 answers
568 views

Longest spell to cast from pages of spellbook

While practicing for a school coding challenge, I came across this problem. My code got the right answers but exceeded the time limited. Any tips for how to reduce the time complexity? https://pctc....
helielicopter123's user avatar
1 vote
3 answers
214 views

LeetCode 856: Score of Parentheses

Given a balanced parentheses string s, return the score of the string. The score of a balanced parentheses string is based on the following rule: - "()" ...
jason's user avatar
  • 21
1 vote
2 answers
125 views

Optimizing an algebraic assignment puzzle

I am going to do a math competition which allows writing programs to solve problems. The code attempts to solve problem 25 from the Purple Comet Spring 2004 Mathematics Meet: In the addition problem <...
Lucien Jaccon's user avatar
1 vote
1 answer
132 views

Read millions of integers from stdin and process them in Python within 2 seconds

This is a competitive programming problem which has never been solved in Python within the time limit of 2 seconds. It is about Disjoint Set Union: Source: Algorithms In Context #10: Disjoint Sets ...
Murilo Perrone's user avatar
6 votes
2 answers
707 views

Making a Rock Paper Scissors game in Python - How to reduce repetition and make it more effective?

I am a "new" coder to Python - saying this because I got stuck in the tutorial hell - and I saw that doing projects was a way of consolidating what I had learnt from those tutorials, so here ...
Aldis Nuts's user avatar
0 votes
2 answers
118 views

Advent of Code 2023 - Day 19: Aplenty (Part 1)

Description: The task involves processing a set of workflows, each comprising rules. These rules define conditions based on part ratings and dictate the destination workflow if the conditions are ...
Harith's user avatar
  • 9,462
4 votes
1 answer
159 views

Roman numerals look and say sequence

I was practicing question 1 of the 2020 british informatics olympiad past paper: The Roman look-and-say description of a string (of Is, Vs, Xs, Ls, Cs, Ds and Ms) is made by taking each block of ...
sbottingota's user avatar
0 votes
2 answers
73 views

Advent of Code 2023 - Day 15: Lens Library

Part 1: The task involves initializing the Lava Production Facility using an initialization sequence. The sequence consists of steps, each requiring the application of the Holiday ASCII String Helper ...
Harith's user avatar
  • 9,462
0 votes
1 answer
50 views

Advent of Code 2023 - Day 9: Mirage Maintenance

Part 1: The task involves analyzing an environmental report from an oasis using the Oasis And Sand Instability Sensor (OASIS). The report consists of multiple histories, each containing a sequence of ...
Harith's user avatar
  • 9,462

15 30 50 per page
1
2 3 4 5
69