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.

Filter by
Sorted by
Tagged with
1
vote
2answers
83 views

Store procedure timing out sometimes

Can someone please find out why this store procedure is timing out? ...
2
votes
2answers
1k views

Optimizing SPOJ edit distance solution

I was doing a standard problem of DP (dynamic programming) on SPOJ Edit Distance using Python. ...
2
votes
2answers
1k views

Reducing time limit for prime number program

I have to create a program in which t sets of m and n will be given by the user. For each ...
4
votes
1answer
617 views

Outputting prime numbers between two numbers

What is the best practice to output a list of prime numbers between two numbers? How can I achieve a better running time? This is a solution to a SPOJ problem which is getting Time Limit Exceeded. <...
6
votes
3answers
2k views

Hackers Ranking String Similarity

I am currently trying to teach myself some programming. I have started to work with Python by doing this challenge. For each test case, I need to find the sum of the self-similarities of a string ...
1
vote
1answer
6k views

SPOJ Problem 2 - Prime Generator

I'm trying to solve this problem. After a couple of tries, this is what I pulled off: ...
9
votes
3answers
4k views

3n + 1 problem optimization

The problem can be viewed here, since it's styled. I don't think I should just copy and paste. I implemented recessive function and dynamic programming to solve it. It can successfully passed UVa ...
6
votes
2answers
3k views

Efficient implementation of a Dynamic Programming challenge

I wrote the following code for a Dynamic Programming problem but the online judge gives me a 'Time Limit Exceeded' error. How can I optimize this code to make it more efficient, especially the part ...
3
votes
2answers
787 views

UVA 10474 - “Where is the marble?” time limit

I have a problem from UVA online judge here. I have read it tons of times, and as they said, I have to get the answer really fast. I have used a binary search and ...
2
votes
1answer
297 views

“Unfriendly Number” challenge

I tried to solve the Unfriendly Number problem on InterviewStreet: There is one friendly number, K, and N unfriendly numbers. We want to find how many numbers are there which exactly divide the ...
2
votes
2answers
500 views

Optimization in overcoming TLE in interviewStreet problem

I have been trying to get the problem Quadrant Queries correct for a while now. Although my approach is an optimal one, I am getting a TLE on 3 test cases. Please help me optimize my approach so that ...
3
votes
1answer
295 views

Mathematical programming puzzles

This is a solution I wrote for a programming puzzle which I believe and I'm sure is correct, but for two of their test cases the online judge gives me 'Time Limit Exceeded' only by a few 100ms! I've ...
5
votes
2answers
2k views

Handling addition of two binary numbers

This code is for handling addition of two binary numbers, which can be as long as 100,000 bits... and up to 500,000 queries are performed. High-level pseudocode: First input ...
3
votes
1answer
3k views

Output strings from a set in lexicographical order

Puzzle Description: You are given 'n' strings w1, w2, ......, wn. Let Si denote the set of strings formed by considering all unique substrings of the string wi. A substring is defined as a ...
7
votes
1answer
1k views

Optimizing string match algorithm

I was trying to solve this problem. I thought of any possible relation between the number of matches among subsequent substrings, but could not find one. So, the probably naive solution that I ...
0
votes
1answer
746 views

Comparing rows of a matrix with some row vectors

I have run this program for five hours and it has not yet completed. I wonder if we can make changes to reduce the computation time. I use several for loop and this greatly increases the computation ...
5
votes
2answers
6k views

Finding the next palindrome of a number string

Here is the problem: A positive integer is called a palindrome if its representation in the decimal system is the same when read from left to right and from right to left. For a given positive ...
5
votes
1answer
6k views

Time Limit Exceeds [HS11DIVS] - How to make it faster?

Here is the question. From SPOJ [HS11DIVS]. Now , the problem is that my code works perfectly for small numbers. But when it comes to Large numbers , the time limit exceeds. I am not getting any hint ...