All Questions
Tagged with performance programming-challenge
633 questions
5
votes
2
answers
173
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 ...
6
votes
2
answers
232
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
2
answers
196
views
Leetcode 93: Restore IP Addresses (C version)
This is posted in response to this request made in a discussion of my "C-ish" answer to a recent Code Review question regarding a Python solution to a Leetcode challenge. It was reported ...
4
votes
1
answer
140
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
106
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
882
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 ...
3
votes
1
answer
237
views
Leetcode: Number of Islands - BFS (Queue vs Recursion)
I was playing around with leetcode's Number of Islands.
As per the challenge's description:
Given an m x n 2D binary grid grid which represents a map of '1's
(land) and '0's (water), return the ...
3
votes
2
answers
95
views
Optimizing a Function to Check Pronic Numbers in JavaScript
I've written a function in JavaScript to check whether a given number is a Pronic number. A Pronic number, also known as an oblong number, rectangular number, or ...
4
votes
2
answers
66
views
Optimizing a Function to Generate a Row of Consecutive Odd Numbers in a Triangle
I've written a JavaScript function that generates a row of consecutive odd numbers in a triangle. The triangle looks like this:
...
3
votes
1
answer
126
views
Coding puzzle - Passing year books
Question:
There are n students, numbered from 1 to n, each with their own
yearbook. They would like to pass their yearbooks around and get them
signed by other students.
You're given a list of n ...
6
votes
3
answers
465
views
Leetcode: Largest Number
I was trying out leetcode's Largest Number.
As per the challenge's description:
Given a list of non-negative integers nums, arrange them such that
they form the largest number and return it. Since ...
4
votes
1
answer
153
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 ...
4
votes
2
answers
513
views
Leetcode: Steps to Make Array Non-decreasing
I was trying out leetcode's Steps to Make Array Non-decreasing
As per the challenge's description:
You are given a 0-indexed integer array nums. In one step, remove all
elements nums[i] where nums[i ...
1
vote
2
answers
136
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
<...
9
votes
4
answers
2k
views
Leetcode : First Missing Positive
I was trying out leetcode's first missing positive.
As per the challenge's description:
Given an unsorted integer array nums, return the smallest missing
positive integer.
You must implement an ...