All Questions
17 questions
4
votes
1
answer
156
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
599
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....
3
votes
1
answer
521
views
Using Python to search a sorted 2D Matrix
Code
Problem
...
5
votes
2
answers
320
views
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 ...
0
votes
2
answers
56
views
Incrementing specified list values, with "catch-up" [closed]
I completed a coding challenge recently in which my function was to be given two parameters: N, the number of counters to be used (numbered 1 through N) - and A, an array of integers. Iterating ...
3
votes
1
answer
806
views
"Tara's Beautiful Permutations" challenge
I'm practising my coding skills using Python to answer medium to difficult problems on sites like HackerRank.
Here is the challenge. Given an array of integers, where each number can appear at most ...
4
votes
1
answer
1k
views
Genomic Range Query in Python
Recently, I worked on one of the Codility Training - Genomic Range Query (please refer to one of the evaluation report for the detail of the task.
The solution in Python is based on prefix sum, and ...
7
votes
1
answer
554
views
Check consistency of a list of statements, with fuzzy rhyme matching
I made a program today that solves the following problem on a programming competition site (open.kattis.com): Check if all statements with the following format X is Y or X not Y are consistent. X and ...
6
votes
1
answer
2k
views
MaxCounters solution
I am doing this Codility problem
You are given N counters, initially set to 0, and you have two possible operations on them:
increase(X) − counter X is increased by 1,
max counter − all ...
1
vote
1
answer
83
views
Finding the distance between every indices in an array that contain odd numbers
I'm doing this HackerRank problem which basically boils down to what I've written in the title. We have to find out the distance between all the odd values in the array. I've written this code below ...
2
votes
1
answer
6k
views
HackerRank: Left Array Rotation in Python
Here is the problem on HackerRank. I want to know how I can improve this code. I am mainly trying to improve the following skills: Documentation, functional programming (top-down approach), accurately ...
9
votes
2
answers
2k
views
Solving 'decent numbers' that follow specific division rules
HackerRank Problem Statement
I have to find the largest 'decent number' having N digits. A decent number has the following properties:
3, 5, or both as its digits. ...
13
votes
5
answers
9k
views
"Algorithmic Crush" problem hitting timeout errors
This is the HackerRank problem Algorithmic Crush:
You are given a list of size N, initialized with zeroes. You have to perform ...
4
votes
3
answers
4k
views
Find the index of the element with maximum absolute deviation
I just completed a Codility test. The question presented was pretty simple but I may have over thought it.
Question:
Find the element which has the highest absolute deviation from the mean. E.g. <...