f("c.b.a", ".b.a") -> true

f("d.c.b.a, ".b.a") -> false

f("b.a", ".b.a") -> false

function f(x,y) {

// ???

}

Reply to this note

Please Login to reply.

Discussion

function f(x,y) {

if (x.startsWith("d")) return false;

if (x.endsWith(y)) return true;

}

function f(x,y) {

const splittedX = x.split(".");

if (splittedX.length > 3) return false;

if (x.endsWith(y)) return true;

}