Questions tagged [time-limit-exceeded]
When the code scales so poorly in the face of large inputs that it cannot complete in a reasonable amount of time, use this instead of the [performance] tag.
1,058
questions
151
votes
17
answers
20k
views
Disproving Euler proposition by brute force in C
I wrote a little bit of code to brute force disprove the Euler proposition that states:
$$a^4 + b^4 + c^4 = d^4$$
has no solution when \$a\$, \$b\$, \$c\$, \$d\$ are positive integers.
I'm no ...
24
votes
7
answers
14k
views
Finding pairs of Amicable Numbers, up to 10000
I have this program to find pairs of amicable numbers in C:
...
23
votes
8
answers
3k
views
Area of the triangle generated by the hands of a clock
Problem explanation:
Let’s suppose we have a clock that has an hour hand 3 units long, a minute hand 4 units long, and a second hand 5 units long. The hour hand moves once every hour, the minute hand ...
21
votes
3
answers
4k
views
Loading military units into ships optimally, using backtracking
I solved the following problem using backtracking:
We are given a list of military units, their weight and their
(numerical) strength. We have a number of ships with a limited
carrying capacity....
20
votes
2
answers
3k
views
Search a big (13 GB) Outlook PST file
I have an Outlook PST file of a pretty big size (13 GB). For some indexing purpose I needed to scan through the full PST file to get all the PR_SEARCH_KEY and then ...
20
votes
1
answer
728
views
Remapping and interpolating 255x1024 array
I have a function that accepts a \$255\times1024\$ array and remaps it to another array in order to account for some hardware related distortion (lines that should be straight are curved by the lens). ...
19
votes
3
answers
1k
views
Enigma machine simulator - improving recursive algorithm performance
I'm new to Haskell and am confused by why my code seems to preform so poorly, and wonder if there's something I've not grasped about the coding philosophy behind the language, or the best way to take ...
19
votes
9
answers
2k
views
Repeatedly eliminate a substring
I'm trying to pass a programming challenge where we are to replace all instances of a substring in a string until there are none left. So an input like
...
18
votes
5
answers
3k
views
Flipping coins performance
This is the Flipping coins problem on CodeChef:
There are \$N\$ coins kept on the table, numbered from \$0\$ to \$N - 1\$. Initially, each coin is kept tails up. You have to perform two types of ...
18
votes
4
answers
3k
views
Leetcode 15. 3 Sum
Problem statement
Given an array S of n integers, are there elements a, ...
17
votes
7
answers
12k
views
Hacker Rank: Array left rotation
This code is to solve the Hacker Rank problem array left rotation.
A left rotation operation on an array of size n shifts each of the array's elements 1 unit to the left. For example, if 2 left ...
17
votes
2
answers
2k
views
Yandex programming contest: Alarms
I've tried to solve this challenge about 4 hours during the contest, but all my attempts exceeded the time limit. I tried to solve it with min-heap, but can't pass all the tests. How it can be solved ...
14
votes
6
answers
18k
views
Counting numbers with specific digits
The challenge:
Suppose you are inhabitant of a planet where 1, 7, and 9 are lucky digits. A lucky number for you is a number that contains only your lucky digits in it. For ex: 1, 79, 911, 9917 etc....
14
votes
2
answers
3k
views
O PC, why are you so slow?
In order to test some software I've written, I need to write values to a test harness with OLE for Process Control (OPC). The problem is, for a larger range of values I'm generating points for (say ...
14
votes
4
answers
2k
views
Codechef: Prime Number Generator
Peter wants to generate some prime numbers for his cryptosystem. Help
him! Your task is to generate all prime numbers between two given
numbers!
Input
The input begins with the number t of test cases ...