у меня есть два больших интерфейсаВаша главная ошибка в этом, интерфейсы должны быть минимальны и описывать тот минимум, который требуется в конкретном месте.
{select: string}
и/или {items: number[]}
export default function({ types: t }) {
return {
visitor: {
Identifier(path) {
if(path.isIdentifier({ name: 'test' })) {
path.parentPath.get('init').node.value = 777
}
}
}
};
};
let observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.lastElementChild.classList.add(classes.image + "_active");
entry.target.lastElementChild.style.opacity = entry.intersectionRatio;
} else {
entry.target.lastElementChild.classList.remove(classes.image + "_active");
}
});
},
{
threshold: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
}
);
block.forEach((value) => observer.observe(value));
что нужно почитать и изучить дня того, чтобы написать транслятор
public void checkPalindrome(string input)
{
string result = isPolindrome(input) ? "Yes, it's a Palindrome" : "No, it's not a Palindrome";
Console.WriteLine(result);
}
private bool isPolindrome(string input)
{
int halfLength = input.Length / 2;
for (int i = 0; i < halfLength; i++)
{
if (input[i] != input[input.Length - i - 1])
return false;
}
return true;
}
так получим наилучшую возможную сложность O(n / 2) и Ω(1) В качестве результата берётся самая длинная найденная подстроказадачу можно решить такой функцией:
function findLongestMatchSubstring(str1, str2) {
for(let len = str1.length; len--;) {
for(let pos = 0; pos + len <= str1.length; pos++) {
const substr = str1.slice(pos, pos + len);
if(str2.includes(substr)) {
return substr;
}
}
}
}