All Questions
Tagged with time-limit-exceeded c#
43
questions
4
votes
1
answer
834
views
Kattis challenge, processing string with special characters and conditions
I'm new to programming challenges and I'm attempting the following Kattis challenge Sim.
This problem is an extension of another Kattis problem - backspace. In that problem, every time we see a ...
2
votes
1
answer
110
views
Shortest route algo terribly slow
First post. I posted this on stack as well but somebody suggested I post it here too/instead.
I wrote a shortest-path script for a Unity game project, and while it works, it gets so slow when applied ...
1
vote
1
answer
247
views
Sort and Delete duplicate image files
I'm trying to make a console application to sort and delete duplicate image files. I have a folder with about 20000 images which take up roughly 70GB of space.
I wrote the following script and it ...
0
votes
2
answers
174
views
CodeWars kata Fusc function running too long, but very fast locally
I have a solution to this CodeWars challenge that's being rejected as "too slow".
Basically, write public static BigInteger Fusc(BigInteger n) given:
...
3
votes
1
answer
221
views
LeetCode - Weekly Contest 213 - Kth Smallest Instructions
Hi I participated in Leetcode weekly contest 213 and am facing issue with submission for below question
Kth Smallest Instructions
Bob is standing at cell (0, 0), and he wants to reach destination:
(...
6
votes
1
answer
210
views
Immediate Smaller Element Time Limit Exceeded
Immediate Smaller Element The code is working fine Code is here. For each element in the array, check whether the right adjacent element (on the next immediate position) of the array is smaller. If ...
1
vote
0
answers
826
views
Sending device data of 10k items with Parallel.ForEach
I have a deviceList of more than 10k items and want to send data by calling another method.
I tried to use Parallel.Foreach but I'm not sure is this the correct ...
17
votes
7
answers
12k
views
Hacker Rank: Array left rotation
This code is to solve the Hacker Rank problem array left rotation.
A left rotation operation on an array of size n shifts each of the array's elements 1 unit to the left. For example, if 2 left ...
3
votes
1
answer
405
views
Langton's Ant simulation
I created a simple program to simulate the Ant's path. The Ant moves north, west, east and south. Each time the Anth moves to an "uncharted" location, I build a Square and give it a color. Each time ...
9
votes
2
answers
650
views
Project Euler #119 : Digit power sum
From problem #119 of the Project Euler :
The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 83 = 512. Another example of a number with ...
5
votes
1
answer
160
views
Web page downloader that supports redirects
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 ...
12
votes
4
answers
13k
views
Finding the first duplicate in an array
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 ...
2
votes
0
answers
286
views
Learn trie through Leetcode 212
Problem statement:
Given a 2D board and a list of words from the dictionary, find all words in the board.
Each word must be constructed from letters of sequentially adjacent cell, where "...
1
vote
2
answers
631
views
Depth-first search of a graph in C# (HackerRank problem)
I'm trying to solve a problem from HackerRank. I got the correct algorithm, but it seems to be too inefficient. After checking the code with 10 given test cases, 3 cases are good and 7 return a ...
6
votes
2
answers
3k
views
Maximum absolute difference of array elements
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] -...