All Questions
Tagged with performanceprogramming-challenge
633 questions
59votes
9answers
14kviews
Project Euler problem 1 in Python - Multiples of 3 and 5
I'd like suggestions for optimizing this brute force solution to problem 1. The algorithm currently checks every integer between 3 and 1000. I'd like to cut as many unnecessary calls to ...
33votes
7answers
6kviews
Project Euler #7 10001st prime
I decided to start working on the Euler project exercises. I'm doing fine for now but the seventh problem is running quite slow and I can't think of anything to make it work faster. It takes around ...
32votes
8answers
5kviews
Project Euler Problem 45
As a self-teaching Python beginner for almost 4 months, I have mostly been doing online challenges including Project Euler problems. Problem 45 asks: Triangle, pentagonal, and hexagonal numbers are ...
32votes
6answers
3kviews
Aliens at the train
I solved this problem on SPOJ: The aliens have arrived to Earth and everything is in harmony, the two races can live together. However, one specific Female Alien does not want to see humans on ...
30votes
3answers
27kviews
Perm-Missing-Elem: 100% functional score, but only 60% performance
I cannot figure out why I didn't get 100% success from the Codility's Perm-Missing-Element test even I solve with \$O(n)\$. I will appreciate any advice/answers. You can see the problem, my code, and ...
30votes
6answers
4kviews
DailyProgrammer 284: Wandering Fingers
Description Software like Swype and SwiftKey lets smartphone users enter text by dragging their finger over the on-screen keyboard, rather than tapping on each letter. You'll be given ...
26votes
2answers
6kviews
Printing 1,000,000 numbers in 1 sec. in Python
Here's a fairly simple task from CSES Problem Set - Permutations 1070 that reads: A permutation of integers 1,2, …, n is called beautiful if there are no adjacent elements whose difference is 1. ...
25votes
2answers
2kviews
Speed up solution to Project Euler problem 75
I wrote this code for Project Euler problem 75, which asks how many integers ≤ 1500000 exist, where the integer is a perimeter length that can be divided into three integer-length sides of a right ...
25votes
5answers
2kviews
Count distinct primes, discarding palindromes, in under 2 seconds
Problem Statement Generate as many distinct primes P such that reverse (P) is also prime and is not equal to P. Output: Print per line one integer( ≤ 1015 ). Don't print more than 106 ...
24votes
12answers
4kviews
Project Euler 8: Maximum product of 13 adjacent digits
Problem 8 on Project Euler which asks Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the product? This is my solution in Visual C#. ...
23votes
5answers
18kviews
Finding the 10001st prime
I'm solving Project Euler problem 7, which says: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? Here's the ...
20votes
5answers
3kviews
Print the N longest lines in a file
I have implemented the "Find the N longest lines in a file" problem from CodeEval quoted below. I got a full 100 score and 182ms execution time of their data set on the site so I consider the code ...
19votes
6answers
7kviews
Determining if the kangaroos will land in the same position
Problem There are two kangaroos on an x-axis ready to jump in the positive direction (i.e, toward positive infinity). The first kangaroo starts at location x1 and moves at a rate of v1 meters ...
19votes
2answers
2kviews
"ACM ICPC Team" challenge on Hackerrank... Easy?
This challenge took me awhile to figure out, and it's characterized as "easy," so I'm sorta wondering what I missed. Problem Statement You are given a list of N people who are attending ACM-...
17votes
4answers
2kviews
Duplicate like a weapon, arrays like heaven
Challenge: Find the duplicated entry. Specifications: Your program should accept as its first argument a path to a filename. Each line in this file is one test case. Each line begins with ...