View gist:a16a3612545e206cba3ede4125b31931
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
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 |