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
1
vote
1
answer
87
views
HackerRank Algorithm Problem: Climbing the Leaderboard (Python)
Here is the Hackerrank problem which is related to dense ranking and below is my solution which didn't pass the time limit cases. Any better way to optimize this?
...
3
votes
2
answers
303
views
Trailing Digits
https://www.acmicpc.net/problem/23204
I've solved a programming challenge where you need to count the occurrences of a specific digit at the end of the product of multiples of a given number within a ...
0
votes
1
answer
118
views
HackerRank Project Euler 12 (Python) | Highly Divisible Triangular Numbers
I again share my Python code which didn't pass time limit test cases in the HackerRank contest of ProjectEuler.
...
4
votes
1
answer
525
views
calculate the number of ways to pick two different indices
I'm working on a codesignal practice problem
You are given an array of integers a and an integer k. Your task is to calculate the number of ways to pick two different indices i < j, such that a[i] ...
2
votes
1
answer
108
views
Codeforces: Dasha & Nightmares
so I got started with competitive programming about a day ago and I got stuck on the first random question I tried on codeforces. It's called Dasha and Nightmares.
Problem Description:
The problem ...
2
votes
1
answer
745
views
Traveling Salesman Problem for visiting cities
Implement TSP problem using best first algorithm (so it will be
backtracking, branch-and-bound, and best-first). Since you are looking
for a cycle, the start/finish city is not important. Therefore we
...
6
votes
1
answer
127
views
One or more planets to line up with the earth a certain amount of times
I have attempted the below question, however my solution is too slow (i.e. It does not fit the 2 second time constrain for java). How can the solution be optimised?
While at IOI 2020 in Singapore, ...
1
vote
1
answer
56
views
Find all combinations of two companies grouped by the projects they are tendering for
I am working on the task to get all possible combinations (pairs) of ID's (companies) which participated in one bid and create a new data frame with ID_1, ID_2, matching parameter (tender ID).
I have ...
2
votes
1
answer
135
views
Find character at given index in a sorted sub strings [closed]
For a given string say dbac the possible substrings are [d,db,dba,dbac,b,ba,bac,a,ac,c]. Sort them and concatenate to a string: ...
4
votes
2
answers
118
views
Find largest sum not involving consecutive values
There is a question to basically find the largest sum in an array, such that no two elements are chosen adjacent to each other. The concept is to recursively calculate the sum, while considering and ...
1
vote
1
answer
212
views
Positive Segments
I'm trying to solve the following question:
You have an array A of size n, containing −1 or 1 only, and s segments (not necessarily different). Each segment is defined by 2 integers li and ri (1 ≤ li ...
-2
votes
1
answer
56
views
Market Portfolio Binary Search Tree [closed]
I'm trying to solve the following problem here:
First line of input contains the number of days D. The next d lines contains a character c and a number x. If c is B, then buy stock . If c is S, then ...
4
votes
2
answers
589
views
O(nlogn) Lexicographically minimal rotation code but tle on this particular case
Based on a small suggestion here , this code tries to find lexicographically minimal rotation (question) by successively comparing two adjacent substrings in the very left , that can potentially give ...
2
votes
1
answer
183
views
k-dice Ways to get a target value
I'm trying to solve the following problem:
You have a k-dice.
A k-dice is a dice which have k-faces and each face have value written from 1 to k.
Eg. A 6-dice is the normal dice we use while playing ...
3
votes
1
answer
1k
views
Knock down tall buildings
I'm trying to solve the following problem:
As you know Bob likes to destroy the buildings.
There are N buildings in a city, ith building has ai floors.
Bob can do the following operation.
Choose a ...