# 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.

818 questions
Filter by
Sorted by
Tagged with
83 views

### Store procedure timing out sometimes

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

### Optimizing SPOJ edit distance solution

I was doing a standard problem of DP (dynamic programming) on SPOJ Edit Distance using Python. ...
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 ...
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. <...
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 ...
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: ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...