View gist:a16a3612545e206cba3ede4125b31931
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
const getFixedModelName = (modelName) => { | |
if (models[modelName]) return modelName; | |
return modelName.slice(0, -1); | |
}; | |
const getModelFilterSchema = (modelName) => { | |
const modelWhereAttrs = {}; | |
const modelAttrs = models[modelName].attributes; | |
for (let attr in modelAttrs) { | |
if (modelAttrs[attr].joiFilter) |
View tape.py
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
class Tape: | |
def __init__(self, _array): | |
self.array = _array | |
if len(self.array) < 2: | |
raise Exception("array must have at least 2 items") | |
# without considering complexity -> because of using sum() function in for loop | |
def getAnswer1(self): | |
leftSum = rithtSum = 0 | |
diff = 999999999 # a big int number for the first comparison |