time-limit-exceeded's questions - English 1answer

648 time-limit-exceeded questions.

I need to select data between 2 values from a table by using MAX because each SID has different VID. My code: ...

I have the following code that works correctly on small data-sets, but times out and crashes on large data sets. The goal of this code is to take a tabular view of data on one sheet and transform it ...

I am doing one kata on codewars: Consider a sequence u where u is defined as follows: The number u(0) = 1 is the first one in u. For each x in u, then y = 2 * x + 1 and z = 3 * x + 1 must be ...

I am solving a question in which we are given the LCM and HCF and two numbers 'a' and 'b', our task is to find the pairs of numbers between a and b [inclusive] whose HCF is the given HCF and LCM is ...

I have code that scans and compares two Excel workbooks, and then pastes all of the differences between the two into a new sheet. My code is working properly - the only problem is when the Excel ...

From LeetCode medium 3. Longest Substring Without Repeating Characters: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", ...

I have solved a spoj question CLASS LEADER. For each test case there are n students and a paper will be given to student m and now the game starts, the student m will pass the paper by o positions ...

I am trying to solve this problem on Codechef, which has a list of \$N\$ coins, all initially tails-up, and a list of \$Q\$ commands. There are two possible commands, ...

I am working on the "Bovine Shuffle" problem from the December 2017 USA Computing Olympiad, and have got it to work for every test case beside two. When I run these two cases on my own computer, they ...

I wrote a class that downloads the HTML of a page from the internet. This class also manages redirects. This works well but I'm not very satisfied about time management for slower servers. In fact, if ...

I am trying to solve a question from array section: You are given an array of N integers, A1, A2 ,…, AN. Return maximum value of f(i, j) for all 1 ≤ i, j ≤ N. f(i, j) is defined as |A[i] -...

Task You are given a string S containing only decimal digits ('0' through '9') and a number N. Your task is to insert an arbitrary number (including zero) of plus signs '+' into S in order to ...

I have written a program to optimize a point cloud in dependency of their distances to each other. The code works very well for smaller number of points. For 1700 points it takes ca. 6 minutes. But I ...

I have a DelayQueue, and the goal is to collect statistical information from the collection in O(1) time and space from ...

I'm working on this challenge: Given an array of integers of size N. Assume ‘0’ as invalid number and all other as valid number. Write a program that modifies the array in such a way that if next ...

I read the solution to this question, which seems to be the same target. My solution is (I'm sure) not the quickest, but some test case is apparently taking longer than 4s. I did a test case with 10,...

I have a number of images that were cropped and their backgrounds removed. I've tried to write a function that will search the original unmodified image for the cropped image so that I can restore the ...

I'm given N integers. I need to find the maximum number of unique integers among all the possible contiguous subarrays of size M. ...

I've exceeded the time limit for my challenge at this point, so I was curious what further optimizations I could have made to my code, as it was exceeding the execution time limit allowed. ...

The given code gives correct output but exceeds the time limit and I have no idea how to optimize it. I know it is of \$O(n^2)\$ complexity but I am not able to get anywhere near to optimizing it. ...

I'm trying to find all possible paths made of 0 from bottom left to top right, only by moving either up or to the right. The input file contains a grid of characters, where ...

The problem I am trying to solve is this. Apples fall at various offsets relative to an apple tree at position a, and oranges fall at various given offsets relative to an orange tree at position b. ...

I tried this spoj problem and solved it using Dynamic Programming, but I was getting Time Limit Exceeded. The challenge is to count the number of occurrences of the subsequence "KEK" in each input ...

Divisors of 42 are : 1, 2, 3, 6, 7, 14, 21, 42. These divisors squared are: 1, 4, 9, 36, 49, 196, 441, 1764. The sum of the squared divisors is 2500 which is 50 * 50, a square! Given two integers ...

You have been given two strings, A and B (of length N each) and Q queries. The strings contain only 0s and/or 1s. For every query, you are given an index i. You have to update the value at ...

The code below is for Hackerrank competition. Seems that it works correctly but performs very slowly and because of it can't pass some tests. The task is to find the maximum GCD of all possible pairs ...

There are N boys standing in line in order 1 to n. For each ith boy (i from 1 to N) W[i] gives his weight. A boy in line can push another boy if his weight is more than or equal to the sum of weight ...

First of all, please note that the input (.vcf) file is very large (>60 GB). So I am reading the .vcf files line by line, but since I have to check for duplicate of two columns present in the input ...

For this problem - https://www.hackerearth.com/practice/data-structures/advanced-data-structures/segment-trees/practice-problems/algorithm/shivam-and-expensive-birthday-gift-da58b2f0/description/, I ...

For a course I need to build a peptide from scratch that matches the given spectrum. So I start with the amino acids that are in the given spectrum and filter those out that do not have the right ...

I am trying to solve a problem as described below: You are given an input of a n*m forest. You have to answer a group of inquiries. Your task is to return the number of trees for every ...

The "Rounding Error" problem of Round 1B of Google Code Jam 2018 is as follows: Problem To finally settle the age-old question of which programming language is the best, you are asking a total ...

I have a softmatch function (below) that takes a donor list and a new entry and looks to see if the given donor already exists. The data is not exact, so I have to use a softmatch to determine ...

My code returns the correct answer the first duplicate is 3 (represented as int f) . I am struggling finding a more efficient way to find the first duplicate? My ...

Context: I had asked a related question on Stack Overflow. On receiving several helpful hints from the commentators there, I could successfully implement averaging of the size distribution over a ...

I am practicing my coding at HackerRank. The exact problem statement can be found here, but to summarize, it is finding the distances of the shortest path from a starting node to every other node in a ...

My algorithm works but it is too slow. I have to ask for help with improving this algorithm because the website which checks this, kicks me for too slow execution. What should I improve here ? ...

I coded an algorithm which shows prime numbers in the ranges provided by the user. The first line states the number of test cases. Example: INPUT2 1 10 1 5...

I need to speed up my algorithm. It is about finding height of tower. Tower is build from buckets. Each bucket has height and radius (1 <= height,radius <= 1000). Variable ...

Recently I asked how one could count the number of registers by the interval as answered in https://stackoverflow.com/questions/49240140/count-number-of-registers-in-interval. The solution works ...

This is the problem: Calculate $$\sum_{i=2}^{10^8} s(i)$$ where \$s(n)\$ is the smallest \$m\$ such that \$n\$ divides \$m!\$. Quite mathematical, I've found a better way than brute ...

Can anyone help me remove TLE (time limit exceeded) from this? Given integer n and array of string of length n. In each query (q of them) we are given l and r and we need to find LCP in this ...

Introduction I drive a white 2CV from home to work, and intend to keep that way until retirement. Once retired, I will sell the 2CV to buy a yacht and sail away. My home is far, far away from ...

I'm trying to solve the Code Jam Dice Straight problem. My Python solution seems to produce the correct output for the first few test cases but then it becomes too slow. How can I possibly optimize it?...

I am doing a Coursera assignment on Hashtable and my solution is taking too long to run. Here is the problem as described in the assignment: The goal of this problem is to implement a variant of ...

The problem is presented here as follows: You are given a sequence A[1], A[2], ..., A[N] . ( |A[i]| ≤ 15007 , 1 ≤ N ≤ 50000 ). A query is defined as follows: Query(x,y) = Max { a[i]+a[i+1]+...+...

I can solve this problem with a brute force naive solution, but need to optimize it for time. I'm not in school, but trying to learn fundamentals on my own. I know I need to store the sum of the ...

I'm a beginner to programming and just started python, I've been trying to work through Project Euler challenges. I wrote a program to solve Project Euler #12, which asks for the smallest number of ...

The question is: There is a set An, and it consists of integers from 1 to n. ...

I have code that runs and does what I want it to do with the click of the command button, however when executing, it runs very slow. The code grabs data from one sheet and inserts/formats it into ...

Related tags

Hot questions

Language

Popular Tags