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
'use strict'; | |
const puppeteer = require('puppeteer'); | |
const ProxyChain = require('proxy-chain'); | |
const uas = [ | |
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36', | |
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', | |
]; |
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
'use strict'; | |
function print(arr) { | |
var res = ''; | |
for (var i = 0; i < arr.length; i++) { | |
res += arr[i]; | |
}; | |
return res; | |
} |
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
/* | |
Assume you have a method isSubstring which checks if one word is a substring of | |
another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using | |
only one call to isSubstring (i.e., “waterbottle” is a rotation of “erbottlewat”). | |
*/ | |
function isRotation(str1, str2) { | |
if(str1.length > 0 && str1.length === str2.length) { | |
var concatStr = str1 + str1; | |
return concatStr.indexOf(str2) !== -1; | |
} |
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
function stringsAreAnagrams(str1, str2) { | |
if(str1.length !== str2.length) { | |
return false; | |
} | |
for (var i = 0; i < str1.length; i++) { | |
if(str2.indexOf(str1[i]) === -1 ) { | |
return false; | |
} | |
}; | |
return true; |
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
/* | |
Example input => output | |
aaaaaaaaaaaaaaaabc => abc | |
aaaaabbbac => abac | |
*/ | |
function removeDuplicates(str) { | |
if(str === null || str === undefined) { | |
return null | |
} |