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 isValid(s) { | |
var stack = []; | |
for (var i = 0; i < s.length; i++) { | |
var c = s[i]; | |
if (c == '(' || c== '[' || c == '{') { | |
stack.push(c); | |
continue; | |
} | |
if (c == ')' || c== ']' || c == '}') { | |
var l = stack.pop(); |
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
choco install nimbletext | |
choco install nimbleset | |
choco install f.lux | |
choco install notepadplusplus | |
choco install teracopy | |
choco install rdcman | |
choco install fiddler4 | |
choco install linqpad | |
choco install sandboxie | |
choco install adobereader-update |
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 flatten(arr) { | |
return arr.reduce(function(c,l){ | |
return c.concat(Array.isArray(l) ? flatten(l) : l); | |
},[]); | |
} | |
flatten([1, [2], [3, [[4]]]]); |
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 smallestCommons(arr) { | |
range = findRange(arr); | |
return calcRangeLCM(range); | |
} | |
function findRange(arr){ | |
//arr=[1,5] ==> res=[1,2,3,4,5] | |
var res = []; | |
var min = Math.min.apply(null,arr); | |
var max = Math.max.apply(null,arr); | |
for(var i = min; i <=max;i++){ |
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 diff(arr1, arr2) { | |
if(arr1.length === 0){ | |
return arr2; | |
} | |
if(arr2.length === 0){ | |
return arr1; | |
} | |
var newArr = []; | |
var deletedArr = []; | |
newArr = arr1.concat(arr2); |
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
## please note that I was too lazy to write a new script :D ,, so I just edited one of pygene demos :D | |
## this script is written only for lower case chars ,, change the word you want to hack by changing the variable teststr | |
import math,random | |
def stringNorm(s): | |
norm = 0 | |
for c in s: | |
if not c==" ": | |
norm+=math.pow(ord(c),2) | |
return math.sqrt(norm) |