Для палиндрома не нужно создавать 2 массива, там все проще: const palindrome = (value) => { const str = value.toString().toLowerCase(); return str === str.split("").reverse().join(""); };
1) Palindrome challenge can be done easier - you should use two counters: one from the beginning (i) and one from the end (j) and check on each iteration if string[i] == string[j]. If not - return false. Iterate while i!=j (for string with odd length) and i+1!=j (for string with even length). For integer type it is easier to parse integer as a string. 2) For FizzBuzz challenge solution is wrong, because when the number can be divided by 3 and 5 (e.g. 15) it will return only "Fizz" as it pass the first if statement. First of all, you should check if the number can be divided by 3 and 5, and only after that separate cases. 3) The good practice is to check if the lengths of the words are equal - it should skip some tests where they aren't. 4) Wrong solution, as you had to lowercase the string, because uppercase vowels are also vowelsю 5) Good solution, but there is a solution with constant complexity - Binet's formula. I checked both methods and all Fibonacci numbers which were lower than Max value for long type (2^63 -1) were equal, so it is better solution, which can be used here). But still , thx for the video)
Умничка
Для палиндрома не нужно создавать 2 массива, там все проще:
const palindrome = (value) => {
const str = value.toString().toLowerCase();
return str === str.split("").reverse().join("");
};
Где-то попадалась история про разработчика фреймворка, который провалил собес по своему же инструменту 😅
Я тоже такое слышала😅
Спасибо за разбор задачек
на здоровье, рада что было полезно 😉
1) Palindrome challenge can be done easier - you should use two counters: one from the beginning (i) and one from the end (j) and check on each iteration if string[i] == string[j]. If not - return false. Iterate while i!=j (for string with odd length) and i+1!=j (for string with even length). For integer type it is easier to parse integer as a string.
2) For FizzBuzz challenge solution is wrong, because when the number can be divided by 3 and 5 (e.g. 15) it will return only "Fizz" as it pass the first if statement. First of all, you should check if the number can be divided by 3 and 5, and only after that separate cases.
3) The good practice is to check if the lengths of the words are equal - it should skip some tests where they aren't.
4) Wrong solution, as you had to lowercase the string, because uppercase vowels are also vowelsю
5) Good solution, but there is a solution with constant complexity - Binet's formula. I checked both methods and all Fibonacci numbers which were lower than Max value for long type (2^63 -1) were equal, so it is better solution, which can be used here).
But still , thx for the video)
Спасибо!