**683 time-limit-exceeded questions.**

Project Euler Problem 23
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of \$28\$ would be \$1 + 2 ...

I have been playing around in hacker rank with Python these days, and now pulling my hair out on this question to solve the Euler's problem in the least time required.
If we list all the natural ...

I'm very new to python (been coding for about two days) and have created a programme that simulates blackjack games so that I can work out optimal strategy over many iterations.
The problem is that ...

I have implemented my solution and I thought it was pretty efficient and passes most of the cases but seems like it fails some of the test cases when the input size is very large. I basically push ...

I've written a Powershell script that uses Robocopy to get the full path of all files on a drive and then run it through a foreach loop to get the owner for each file and generate it in a CSV. The ...

You will be given an integer k and a list of integers. Count the number of distinct valid pair of integers (a,b) in the list for which a+k=b.
For example, the array [1,1,1,2] has two different ...

I have been trying to solve this question.
Given an unordered array consisting of consecutive integers [1, 2, 3, …, n], find the minimum number of two-element swaps to sort the array.
I was able ...

Problem: Write a function that takes a positive integer and returns the next smaller positive integer containing the same digits.
My solution:
...

I'm working on this kata from Codewars. The task is:
Given a certain number, how many multiples of three could you obtain with its digits?
Supose that you have the number 362. The numbers that ...

I was trying to solve this problem called lattice path from Project Euler:
Count the number of unique paths to travel from the top left to the bottom right of a lattice of squares.
How many such ...

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

I'm learning Golang and have been trying to get 100% on the following Hackerrank practice challenge: Climbing the Leaderboard
The code passes ~8 of 11 tests. The Hackerrank tests are time-bound and ...

I have been trying to solve this simple problem on SPOJ for quite some time now, but I keep on getting TLE (Time limit exceeded) for some reason.
Since the problem is in Portuguese, a brief ...

Problem Statement:
A k-distinct-partition of a number \$n\$ is a set of \$k\$ distinct positive integers that add up to \$n\$. For example, the 3-distinct partitions of 10 are
\$1+2+7\$
\$...

I attempted this sample question from the Australia Infomatics Competition. TL;DR - Each line of input contains two numbers, representing a mutual friendship relationship. The output needs to be the ...

There is a question in a contest but it doesn't have any answer. I solve it but I get time limit for most of test case. Is it possible to improve my code or give a better approach?
Question
There is ...

Croatian Open Competition in Informatics, contest 3, December 8, 2007
4. DEJAVU
\$N\$ points are placed in the coordinate plane.
Write a program that calculates how many ways we can choose ...

You are given an array of n+2 elements. All elements of the array are in range 1 to n. All elements occur once except two numbers, which occur twice. Your task is to find the two repeating numbers.
...

Description
Master Locksmith has just finished the work of his life: a combination
lock so big and complex that no one will ever open it without knowing
the right combination. He's done testing ...

Given an array and a number k (each element is as a disc has a number from 0 to k-1 written around its circumference,Consecutive numbers are adjacent to each other, i.e. 1 is between 0 and 2, and ...

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

I recently tried to solve the Josephus Problem on Sphere Online to help answer this question but am getting TLE for any solution I come up with.
The exact parameters of the problem are:
This is ...

The following code is my solution to an old problem I found today.
Input Format
Line 1: Two integers, N (1 ≤ N ≤ 106) and window size K (1 ≤ K ≤ N)
Line 2: N positive integers of upvote ...

Given an array A of integers, find the maximum of j - i subjected to the constraint of A[i] <= A[j].
If there is no solution possible, return 0.
Example :
A : [3 5 4 2]
Output : 2
for the pair ...

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

I'm currently working through the google FooBar challenge, and I'm on the third level, in which I have to find the distance between the top left and bottom right points on a grid. The grid is filled ...

Question (SAD Queries on CodeChef)
The Summed Absolute Difference (SAD) of two arrays. Given arrays
(1-indexed) \$P\$ and \$Q\$ of lengths \$p\$ and \$q\$.
Given a collection of \$n\$ arrays ...

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 have a question that is similar in spirit to this previously asked question. Nonetheless, I can't seem to figure out a suitable solution.
Input: I have CSV data that looks like (FICTIONAL ...

The macro below clears cells that do not match any cell in comparison to a range (a master list). It works on small file but is too slow to work for files with large ranges.
...

Problem Statement
The season for Snuke Festival has come again this year. First of all,
Ringo will perform a ritual to summon Snuke. For the ritual, he needs
an altar, which consists of three ...

I attempted the 3-Sum problem on Leetcode, where the problem asks to find all possible triplets of numbers in a given list such that their sum is 0. My code worked, but it exceeded the time limit for ...

I started doing hackerrank problems only recently and here's my attempt to solve this problem.
Basically, you're given two integers N and ...

I am trying to solve the following exercise using Javascript:
A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be ...

I've taken this algorithm question, which is to find the indexes of any two numbers in an array that sum to a given number. It is quite a simple problem to solve. But it is the execution time of my ...

PROBLEM
The Facebook campus has N different attractions, numbered from 1 to N
in decreasing order of popularity. The name of the ith attraction is
Ai, a unique, non-empty string consisting of ...

I had written code in C++ to create transformation filters to get input, sort (custom_sorting and existing sorting routine) and write the output to stdin and file. When I presented it to my teacher, ...

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 getting a TLE on my submission to AGGRCOW - Aggressive cows on SPOJ:
Farmer John has built a new long barn, with N (2 <= N <= 100,000)
stalls. The stalls are located along a straight ...

I have found that my code causes my Excel to 'not respond' when it gets to this for loop, For thisRow = 2 To lastWSrow(outWS). I'm guessing this is because I am ...

I have incremented an integer in the function nextpalin() and converted it into a std::string for finding whether it's a ...

The problem
You are given a list of \$ n \$ positive integers. Your task is to split the list into \$ k \$ subarrays so that the largest subarray sum is minimized.
The input
On the first line you ...

I just made this link please check this out Online Results
I need to select data between 2 values from a table by using MAX because each SID has different VID.
My code:
...

This is a solution to the CodeHhef problem FCTRL2 where we are supposed to find the factorial of numbers up to 100. I have tried several techniques but I am always exceeding their time limit (1 second)...

I'm attempting to solve the problem "Synchronizing Lists" on Kattis.com.
In a nutshell, the problem involves being given two lists: the lists are then to be sorted smallest-to-largest, ...

Honestly, I'm doing a practice and get blocked. Problem link.
The problem is simple, given a string, calculate the number of max length palindromes (Any substring is valid, which means you can take ...

- programming-challenge
- python
- algorithm
- c
- java
- python-3.x
- performance
- primes
- strings
- c
- beginner
- python-2.x
- c#
- mathematics
- combinatorics
- javascript
- array
- ruby
- graph
- vba
- recursion
- excel
- complexity
- dynamic-programming
- sorting

- Players constantly capture enemies and question them, how to deal with it?
- Can't pipe in bash's "mapfile" ... but why?
- How can I take undistorted overhead top view pictures of a stationary gas compressor?
- Zeebus Puzzle #1
- What does a solid, 1 mile diameter subterranean glass sphere look like?
- Can I Misty Step into Midair?
- Kid throwing ice cream cone back to the vendor
- Codegolf Rainbow : Fun with Integer-Arrays
- Method for returning valid URLs from a sitemap URL
- How effective is a spoon to mutilate my former alchemist?
- Why did I have to wave my hand in front of my ID card?
- History of Ctrl-S and Ctrl-Q for flow control
- Do we have to take down the material for 14 days even if the DMCA notice is erroneous?
- Why is peer review so random?
- Did the Hobbits of the Fellowship of the Ring wear hats?
- What's this bifurcating succulent found in a greenhouse in the Gobi Desert?
- How few disks are needed to cover a square efficiently?
- Why is there a towel on my toilet seat?
- How do non-BibTeX users handle citations?
- Taking the front fans out of an Mac Pro Early 2008 to clear out the dust?
- What do you call the act of drinking a whole bottle of, say, water in one go?
- Problem on Determinant.
- How do I communicate to my players that a door is, for the time being, absolutely locked to them?
- What is the correct phraseology for "runway 03 R”?