All Questions
93 questions
4
votes
2
answers
513
views
Leetcode: Steps to Make Array Non-decreasing
I was trying out leetcode's Steps to Make Array Non-decreasing
As per the challenge's description:
You are given a 0-indexed integer array nums. In one step, remove all
elements nums[i] where nums[i ...
9
votes
4
answers
2k
views
Leetcode : First Missing Positive
I was trying out leetcode's first missing positive.
As per the challenge's description:
Given an unsorted integer array nums, return the smallest missing
positive integer.
You must implement an ...
0
votes
1
answer
314
views
HackerRank "Digit sum" challenge
Here's the question:
...
3
votes
1
answer
270
views
Highly divisible triangular number
Highly divisible triangular number, my solution
My solution of challenge from Project Euler takes too much time to execute. Although on lower numbers it works fine. Anyone could look up to my code and ...
2
votes
1
answer
281
views
Codechef: The Chefora Spell
This is the question currently I am trying to solve of codechef and I am able to get the given test cases result but I am getting Time Limit Exceeded when I am trying to submit. Please let me know ...
3
votes
0
answers
198
views
Count unique subsequences
I came across this question in a coding competition (Java-restricted) and I got a time-length-exceeded. I am unable to provide a link as the contest is closed now. Can I know how can I optimise this?
...
-1
votes
1
answer
514
views
Programming challenge - report fraudulent banking activity times out
How can I optimise this code
there is time out error
Program Challenge:
HackerLand National Bank has a simple policy for warning clients about possible fraudulent account activity. If the amount ...
11
votes
6
answers
19k
views
Enhanced Hashmap - Add a number to all keys/values
I had the below problem in a coding test and I got 28/30 tests passes and 2 failed due to a time-out.
Problem You have created a programming language and now you have decided to add ...
-4
votes
1
answer
86
views
Time limit exceeds in this simple program [closed]
Link to problem: https://www.codechef.com/JUNE20B/problems/EVENM
Iam trying to solve a simple problem challenge, but getting TLE.
I had a different approach earlier, so tried this, again with no ...
3
votes
2
answers
131
views
Which products should be purchased with the given amount of money: Hackerrank?
I am writing code for the challenge given here . Below the text:
Each time Sunny and Johnny take a trip to the Ice Cream Parlor, they
pool their money to buy ice cream. On any given day, the ...
4
votes
0
answers
79
views
Extracting cycles from directed graph with max degree 1 and then performing set cover on cycles
I'm trying to solve P1243E in an efficient manner. The problem in simple words is:
Given \$k\$ boxes, \$i\$-th box with \$n_i\$ numbers. All numbers are distinct. We need to select one number from ...
3
votes
1
answer
1k
views
Add a value to each of the array element between two given indices successively
I am trying to solve the HackerRank: Array Manipulation problem using Java.
The problem that I am facing is that the program is running for half of the test cases, while for the other half it is ...
9
votes
3
answers
4k
views
Find the smallest positive integer that is absent from a given array
I made the acquaintance of big-O a couple of weeks ago and am trying to get to grips with it, but although there's a lot of material out there about calculating time complexity, I can't seem to find ...
6
votes
4
answers
6k
views
Counting multiples of 3 up to a given number
I'm attempting a practice problem in Codeforces that requires you to find the number of multiples of 3 less than or equal to a given number. I have written the following code but it gives a TLE once ...
7
votes
2
answers
218
views
Heights of Cats
I have an assignment to solve this problem. However, I have exceeded the time limit required, can anyone suggest where to improve my code?
Cats like to sit in high places. It is not uncommon to see ...