Подтягиваем алгоритмы | Провал на собеседовании

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ธ.ค. 2024

ความคิดเห็น • 6

  • @АлександрБурыхин-к3ч
    @АлександрБурыхин-к3ч ชั่วโมงที่ผ่านมา

    Спасибо за разбор задачек

    • @BADFRONTEND
      @BADFRONTEND  58 นาทีที่ผ่านมา

      на здоровье, рада что было полезно 😉

  • @lucky_lucky_cool
    @lucky_lucky_cool วันที่ผ่านมา +1

    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)

    • @BADFRONTEND
      @BADFRONTEND  วันที่ผ่านมา

      Спасибо!