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 helpDaniel = ( nums ) => { | |
| if( nums == null || nums == undefined || nums.length == 0 ) return []; | |
| const output = []; | |
| const keys = [ | |
| "0", |
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 convertToMinutes = (time) => { | |
| let [hr,minute] = time.split(":"); | |
| if( Number.parseInt(hr) > 23 || Number.parseInt(minute) > 59) return 0; | |
| return ( Number.parseInt(hr)*60)+ Number.parseInt(minute); | |
| } | |
| const minimumTimeDifference = ( times ) =>{ |
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 shuffleClass = (arr,move) =>{ | |
| if( arr == undefined || arr == null ) return []; | |
| if( arr.length == 0 || move == 0 || move == arr.length ) return arr; | |
| if( Math.abs(move) > arr.length ){ | |
| move = move % arr.length; // to handle reshuffling | |
| } |
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 productsArray = nums =>{ | |
| if( nums == undefined || nums == null ) return []; | |
| if( !Array.isArray(nums) ) return []; | |
| if( nums.length == 0 ) return []; | |
| if( nums.length == 1 ) return[0]; | |
| let product = 1; | |
| for(let [index,number] of nums.entries()){ | |
| product = number * product; |
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 getPosition = ( nums, val ) => { | |
| let idxs = [-1,-1]; | |
| let idx = 0; | |
| let idx_val = 0; | |
| if( !Array.isArray(nums) ) return idxs; | |
| if( (nums == undefined) || (nums == null) ) return idxs; | |
| if ( nums.length == 0 ) return idxs; | |
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 elementRemoval = (nums,val) =>{ | |
| if( nums == undefined ) | |
| return 0 | |
| return nums.filter( num=>num!=val ).length; | |
| } |
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 removeDuplicates = (nums) =>{ | |
| if( nums == undefined ) | |
| return 0; | |
| if( nums.length == 0 ) | |
| return 0; | |
| let pointerOne = 0; | |
| let pointerTwo = 1; | |
| let occurence = 0; |