All Questions
434 questions
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 ...
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.
...
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
278
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 ...
1
vote
1
answer
140
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
...
6
votes
2
answers
723
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 ...
4
votes
1
answer
192
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 ...
2
votes
1
answer
178
views
Codewars 4 Kyu kata: "Most frequently used words in a text"
This was the first kata I found hard so I wanted to ask about it. Any ways I could I have done it better?
here's the question -> Most frequently used words in a text
...
3
votes
1
answer
97
views
Finding the number of "block chains" that are a certain length and begin with a certain string
I'm currently practicing for the british informatics olympiad by doing past papers.
I was doing question 3 of the 2019 paper:
A set of children’s blocks, each illustrated with a single different ...
0
votes
1
answer
129
views
HackerRank Project Euler 12 (Python) | Highly Divisible Triangular Numbers
I again share my Python code which didn't pass time limit test cases in the HackerRank contest of ProjectEuler.
...
3
votes
1
answer
366
views
Python function to find the count of digits of numerals in base n up to a given limit
This is a simple exercise to find the count of digits of all numerals in a given base up to a given limit (not including the limit), I wrote it to determine the ratio of bytes saved when the numbers ...
1
vote
1
answer
330
views
Calculate score of rock-paper-scissors (Advent of Code 2022: Day 2)
Advent of code, Day 2.
Here is my code.
Less verbose version of the question follows.
...
1
vote
2
answers
722
views
Find the cheapest flight to reach from source to destination
As the input you get the flight schedule as an array, each element of which is the price of a direct flight between 2 cities ...