All Questions
Tagged with complexity programming-challenge
66 questions
4
votes
1
answer
160
views
Longest spell to cast from pages of spellbook follow-up
This question is from the PCTC 2022 R2 Past Paper and is a follow-up on my previous question. Previous question
I have implemented several solutions suggested, such as creating an array with pages ...
6
votes
4
answers
606
views
Longest spell to cast from pages of spellbook
While practicing for a school coding challenge, I came across this problem. My code got the right answers but exceeded the time limited. Any tips for how to reduce the time complexity?
https://pctc....
1
vote
2
answers
1k
views
Leetcode 55. Jump Game solution
I was working on Jump Game problem on leetcode
Question
You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ...
1
vote
2
answers
465
views
Algorithm for twoSum
This is my PHP algorithm for the twoSum problem in leetCode:
...
3
votes
1
answer
575
views
Finding the minimum element of a stack of numbers
As part of an online programming challenge, I wrote a program that implements a stack of integers, supporting adding and removing elements, finding the last inserted element, and the minimum element. ...
3
votes
0
answers
138
views
Benchmarking multiple implementations of a Code Kata: queue for the self-checkout tills at the supermarket
I was reading this question:
Why is my function timing out when run with a larger data set?
And although I couldn't quite grasp the OP's implementation and so didn't feel like answering.
I did some ...
5
votes
4
answers
581
views
LeetCode: Roman to Integer in Java
I tried solve this easy leetcode challenge in java. Challenge link
Here is my solution
...
3
votes
1
answer
523
views
Using Python to search a sorted 2D Matrix
Code
Problem
...
2
votes
1
answer
499
views
CCC '19 S5:Triangle: The Data Structure
This problem is from [CCC2019]: https://dmoj.ca/problem/ccc19s5/ (Canadian Computing Contest 2019) and I have implemented it in C++.
I used sequence [A054237]: https://oeis.org/A054237/table to ...
4
votes
1
answer
914
views
Hacker Rank Climbing The Leaderboard
This has been asked a couple of times but here is my implementation in C++. I have 11/12 solutions completed. The 6th test case which has 200000 intial scores and Alice has even more scores causes my ...
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
2
answers
325
views
4
votes
3
answers
441
views
Find the first missing positive integer in an array of integers
The problem is the one explained in Given an unsorted integer array, find the first missing positive integer
Given an unsorted integer array, find the first missing positive
integer.
For ...
5
votes
2
answers
400
views
LeetCode: Linked List Cycle
Challenge
https://leetcode.com/explore/interview/card/top-interview-questions-easy/93/linked-list/773/
Given a linked list, determine if it has a cycle in it.
To represent a cycle in the given ...
2
votes
1
answer
4k
views
Python Implementation: Summer of 69
SUMMER OF '69: Return the sum of the numbers in the array, except
ignore sections of numbers starting with a 6 and extending to the next
9 (every 6 will be followed by at least one 9). Return 0 ...