1
const getCharIdx = (c) => c.charCodeAt(0) - "a".charCodeAt(0);2
const isEqual = (a, b) => a.every((v, i) => v == b[i]);4
var checkInclusion = function (s1, s2) {5
const occS1 = new Array(26).fill(0);6
const occS2 = new Array(26).fill(0);8
const s1Len = s1.length,11
if (s1Len > s2Len) return false;15
for (; r < s1Len; r++) {16
occS1[getCharIdx(s1[r])]++;17
occS2[getCharIdx(s2[r])]++;20
if (isEqual(occS1, occS2)) {24
for (; r < s2Len; r++) {25
occS2[getCharIdx(s2[r])]++;26
occS2[getCharIdx(s2[l++])]--;28
if (isEqual(occS1, occS2)) return true;