This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /** | |
// * @param {string} s | |
// * @return {boolean} | |
// */ | |
let brackets = { | |
"(": ")", | |
"[": "]", | |
"{": "}", | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mergeTwoLists = function (l1, l2) { | |
let dummy = new ListNode(-1); | |
let head = dummy; | |
while (l1 !== null && l2 !== null) { | |
if (l1.val <= l2.val) { | |
dummy.next = l1; | |
l1 = l1.next; | |
} else { | |
dummy.next = l2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Initial Hypothesis | |
* @param {string[]} strs | |
* @return {string} | |
*/ | |
var longestCommonPrefix = function(strs) { | |
let splitWords = []; | |
let commonPrefix =[]; | |
strs.forEach((word,i) =>{ | |
splitWords[i] = word.split(''); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} s | |
* @return {number} | |
*/ | |
var romanToInt = function(s) { | |
romanNumerals = { | |
I: 1, | |
V: 5, | |
X: 10, | |
L: 50, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {number} x | |
* @return {boolean} | |
*/ | |
var isPalindrome = function(x) { | |
let reversedNum = 0 | |
//Passes | |
if(x < 0){ | |
return false; | |
}else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {number} x | |
* @return {number} | |
*/ | |
var reverse = function (x) { | |
return parseFloat(x.toString().split('').reverse().join('')) * Math.sign(x); | |
}; | |
//https://www.freecodecamp.org/news/js-basics-how-to-reverse-a-number-9aefc20afa8d/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {number[]} nums | |
* @param {number} target | |
* @return {number[]} | |
*/ | |
var twoSum = function(nums, target) { | |
previousValues = {}; // Set Previous Hash Values | |
for (let i = 0; i < nums.length; i++){ // Loop through entire array | |
currentNum = nums[i]; // Get Current Loop Number | |
neededNum = target - currentNum; //Calculate Number Needed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const LinkedList = require('./LinkedList') | |
describe('#insertAtHead', () => { | |
test('it adds the element to the beginning of the list', () => { | |
const ll = new LinkedList() | |
ll.insertAtHead(10) | |
const oldHead = ll.head | |
ll.insertAtHead(20) | |
expect(ll.head.value).toBe(20) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Linked List | |
class LinkedList { | |
constructor() { | |
this.head = null | |
this.length = 0 | |
} | |
insertAtHead(data) { | |
const newNode = new LinkedListNode(data, this.head) | |
this.head = newNode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm run build | |
> [email protected] build C:\Users\13054\Documents\GitHub\Responsive_Renovations_LLC\ResponsiveRenovations | |
> webpack --mode production | |
[BABEL] Note: The code generator has deoptimised the styling of C:\Users\13054\Documents\GitHub\Responsive_Renovations_LLC\ResponsiveRenovations\src\assets\js\jquery-ui.js as it exceeds the max of 500KB. | |
Hash: bdbfd98ea836b854801c | |
Version: webpack 4.41.5 | |
Time: 137586ms | |
Built at: 05/31/2020 1:22:20 PM |