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 isPalRec = (string, start, end) => { | |
// If there is only one character | |
if (start === end) { | |
return true; | |
} | |
// If first and last | |
// characters do not match | |
if (string[start] !== string[end]) { | |
return false; | |
} |
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
function staircase(n) { | |
// Two dimensional array concept | |
for(let i = 0; i < n; i++){ | |
// Clear the output after each loop | |
let output = ''; | |
for(let j = 0; j < n; j++){ | |
// Loop through, whenever (n-1-i) is bigger than j concat a space else # | |
j < (n -1 -i) ? output += ' ': output += '#'; | |
} | |
console.log(output); |
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
/* | |
Diagonal Difference Solution. | |
sample matrix = [[1,2,3], [4,5,6], [7,8,9]] | |
*/ | |
function diagonalDifference(matrix) { | |
// length of input matrix. | |
const length = matrix.length; | |
let diagonal1 = 0, diagonal2 = 0; | |
// Looping through the array and summing the diagonals. |
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
/* | |
Band Clock is a jquery plugin to display a dynamic band clock. | |
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) | |
and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. | |
Built on top of the jQuery library (http://jquery.com) | |
@source: http://github.com/zaniitiin/band-clock/ | |
@autor: Nitin Jha | |
@version: 1.0 | |
*/ | |
(function($) { |