Skip to content

Commit

Permalink
clean.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeKarlsson committed Apr 23, 2018
1 parent 913a134 commit 5f77747
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 5 deletions.
5 changes: 0 additions & 5 deletions dupNums.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ const findDupsFast = nums => {
return false;
};

const findDupsMemEfficeint = nums => {
let pivot = Math.floor(nums.length / 2);
console.log(pivot);
};

const numbers = [1, 2, 3, 4, 5, 6, 7, 3, 8, 9, 10];

const result = findDupsFast(numbers);
Expand Down
29 changes: 29 additions & 0 deletions romanNumerals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const convertToRomanNumeral = num => {
let roman = {
M: 1000,
CM: 900,
D: 500,
CD: 400,
C: 100,
XC: 90,
L: 50,
XL: 40,
X: 10,
IX: 9,
V: 5,
IV: 4,
I: 1
};
let str = "";

for (let i of Object.keys(roman)) {
let q = Math.floor(num / roman[i]);
num -= q * roman[i];
console.log(num);
str += i.repeat(q);
}

return str;
};
const result = convertToRomanNumeral(8);
console.log(result);
Empty file added secondLargestItemBST.js
Empty file.
24 changes: 24 additions & 0 deletions spareArrayMultiplication.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const matrix1 = [[0, 1], [2, 3], [3, 3], [3, 4]];
const matrix2 = [[0, 4], [2, 3], [3, 3], [3, 4]];

// O(n^2)
// const spareMatrixMult = (mtrx1, mtrx2) => {
// let product = [];
// mtrx1.forEach(cell1 => {
// mtrx2.forEach(cell2 => {
// if (cell1[0] === cell2[0] && cell1[1] === cell2[1]) {
// console.log("hit");
// product.push(cell1);
// }
// });
// });
// return product;
// };

const spareMatrixMult = (mtrx1, mtrx2) => {
let product = [];
return product;
};

const result = spareMatrixMult(matrix1, matrix2);
console.log(result);

0 comments on commit 5f77747

Please sign in to comment.