PRB - 00n -
REF = https://www.youtube.com/watch?v=lD-LuK_VGZI
Array [, 1,2, 3, 4,5,7,9,33,-5,]
Find 2 numbers that when multiplied together will equal 20
> 1] Figure it out solution to problem on “paper” before coding, ex SOL 1
- look at first number in array
- determine the 'multiplier' that firstNumber would need to get to desired sum
- search balance of array for matchingNumber
- if matchingNumber found, return pair()
- else moveNextNumber, repeat process
ex SOL 2, larger array of numbers
- put each uniqe nu
> 2] translat into data structures and algorithms
------------
description: function that takes array of numbers and returns 2 elements that will multiply to twenty
takes:array of numbers
returns: 2 numbers
function returnTwoNumbersThatMultipliedEqualTwenty(arrayNumbers){
for ( i =0,i< arrayNumbers.length, i++){
firstNumber = arrayNumbers[0];
matchNumber = firstNumber / 20;
for (j = i+1, J < arrayNumbers.length, j++){
if (arrayNumbers[j] === matchNumber){
matched = [];
matched.push(firstNumber);
matched.push(matchNumber);
return matched;
}
/*else{
j++;
}*/
}
}
} // END function
pRB - 002 - twenty five horses
REF = https://www.youtube.com/watch?v=i-xqRDwpilM
my solution on Paper ( before watching video)
- 25 totalHorses / 5 maxHorsesPerRace = 5 races, produce 5 raceWinners
- totalRaces = 5
- 5 raceWinners> race > move winner into fastest5Set[], remove from winnnerSet, note originating set , remove all winners from originating sets
- totalRaces = 6
- race 5 sets of 4 horses > move winners into winnersSet[]
- totalRaces = 11
- race set of remaining 4 horses from winnerRound1.set > move winner into winnersSet[]
- totalRaces = 7
- race winnersSet[] > move winner into fiveFastestSet[] as #2 of 5, note originating set, remove winner from winnersSet, from originating set
- race originatingSet of winner ( ex set3)
- totalRaces = 8
- move winner into winnersSet, remove from originating set
- race winnersSet[] > move winner into fiveFastestSet[] as #3 of 5, note originating set, remove winner from winnersSet, from originating set
- totalRaces = 9
- repeat 2 more times for total of 11 races
ID: 7427
NAME: CREATE-article-tech-interview-problem-questions
DESCRIPTION: CREATE-article - tech interview type problem questions
START DATE TIME: 2018-01-21 07:24:21
EST DURATION: 01:00:00
END DATE TIME: 2018-01-21 08:24:21
STATUS: To-Do
PRIORITY: -5
OWNER ID: 1