GDSC February Monthly Challenge

About this event

It is time for a monthly challenge! GDSC @ Conestoga is conducting the first monthly challenge where you will be working on a data structure or data algorithm coding question.

Task

Write a function that takes a non-empty array and returns a quadruple* that matches a targeted sum. The order of returned quadruples does not matter. If no array is found that matches the target sum, return an empty array. Feel free to use any programming language.

Function Signature:

Array<Array<number>> function(Array<number> inputArray, int targetSum) {
                        // your code goes here
}

Sample Input:

inputArray = [7,6,4,-1,1,2]
targetSum = 16

Sample Output:

[[7,6,4,-1], [7,6,1,2]]

* quadruple is an array that contains only 4 elements


You can submit your solution here (put your code on your public Github repo): Monthly Challenge Submission Link. Your solution will be evaluated by the time and space complexity, and the winners will be announced at the end of the month. You will get additional points for writing tests for your code.


Any questions? Reach out to GDSC Lead (Oleksandr Levinskyi) on Discord.

We are looking forward to receiving your submissions!

Thank you,

Conestoga GDSC Team


Organizers