This is a Coding Resource Pack containing 20 algorithmic style programming questions for you to practice along with their solutions! You can solve these questions in any programming/scripting language you want!
Difficulty Level
The difficulty level increases as you go! The questions will get harder as you go! The average difficulty is Medium.
Questions and Overview
Difficulty - Easy
Difficulty - Medium
Difficulty - Hard
Where do I get it?
Click me to get the resource pack and start testing yourself!
How do I submit my approach?
You can submit your approach for any amount of questions you solved down below, by publishing your edited scripts to Roblox as a model and share the link down below! Or make a Github Repository containing your scripts and pasting the link down below!
Where do I find the solutions?
{Soon} Here are the solutions for each problem. Honesty is the best policy. Attempt the questions honestly without cheating. Testing your knowledge and learning is better than copy pasting code! If you are unable to solve a problem, feel free to check out my own clean approach for the same!
Its completely fine! Language barriers exist. The 1st and the 3rd solution of yours is the incorrect way of solving the question. You might not have read the questions correctly, but its completely fine
1st one is correct! Time complexity is also O(n). 4th question is correct too! Shortened code -
function cloned (a, b)
for i = #a,1,-1 do
if a[i] ~= b[i] then
return false
end
end
return true
end
For the second question. Instead of merging two arrays. You replaced the first one with the other.
Hereās what I meant by merging.
Given two arrays {14,5,6} and {5,6,6,8} your task is to merge the 2nd array to the 1st one. So array1 becomes {14,5,6,5,6,6,8} and then simply return the array1!
Oh well I read the code in an incorrect manner. My bad. All your solutions are correct so far!
For question 4:
You need to call a function multiple times to fill in the array. Here is my approach
local added = 0; --this number increases by 1 each time we pass in the function
local array = {};
function a (n, array) --n is the number we start the pattern with and we pass in an empty table
if #array >= 10 then return array end; --we have got 10 numbers in our pattern. We no longer need to run the function again!
if #array ~= 0 then
array[#array + 1] = array[#array] + added;
else
array[#array + 1] = n;
end
added += 1;
a(n, array); --calling the same function again with editied values
end
Edit:
If we consider ānā to be 1 then the output of the above code will be as follows -
ur thread is getting cluttered and some ppl might want to like scroll and see wht the whole thing is bout so how bout u make a seperate place where ppl can post answers like a notice board or smthg
I just went through the advanced questions and i feel you did an amazing job coming up with these. also: if there are any sources pls mention not saying tht it looks like there is but if since i feel these are a good exercise
This was rather fun to complete, thank you for putting this out for the community! Hereās all of my solutions, packed in an RBXM. file.rbxm (12.1 KB)