This file contains 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
/* | |
Given a 2D array A[][2] of size N (1 ≤ N ≤ 103), where A[i][0] and A[i][1] denotes the length and breadth of rectangle i respectively. | |
Two rectangle i and j where (i < j) are similar if the ratio of their length and breadth is equal | |
A[i][0] / A[i][1] = A[j][0] / A[j][1] | |
Input : A[][2] = {{4, 8}, {15, 30}, {3, 6}, {10, 20}} | |
Output: 6 |
This file contains 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
// Installed npm packages: jquery underscore request express | |
// jade shelljs passport http sys lodash async mocha chai sinon | |
// sinon-chai moment connect validator restify ejs ws co when | |
// helmet wrench brain mustache should backbone forever debug jsdom | |
/* | |
Please write a function to score a game of bowling, | |
special scoring considerations | |
====================================== |
This file contains 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
// Write a compression and decompression algorithm that results in a smalller string | |
// You can assume all the input parameters are letters of the alphabet | |
function isNumber(char) { | |
return !Number.isNaN(parseInt(char)) && typeof parseInt(char) === 'number' | |
} | |
// str is in this format, number then letter => "2a4f7s154v..." | |
function decompress(str) { | |
if (!str) return str |
OlderNewer