LeetCode 168 Problem 1 - Find Numbers with Even Number of Digits

Поделиться
HTML-код
  • Опубликовано: 7 янв 2025

Комментарии • 28

  • @EricMesa
    @EricMesa 3 года назад +4

    Love that for Python you give the naive version and the Pythonic version. Please keep doing that going forward.

  • @pritomdasradheshyam2154
    @pritomdasradheshyam2154 5 лет назад +6

    This video is so informative. Thanks so much. Would love to see tons of coding explanations in similar format :)

  • @VincentZalzal
    @VincentZalzal 5 лет назад +5

    Nice to see you back! Always interesting to compare languages.
    As a side note, for the 2nd C++ solution at 6:22, I would suggest using the std::count_if algorithm (available since C++98), which does the same thing as the proposed solution with std::accumulate, but in a simpler and more expressive way. Since it maps directly to the problem statement, that would be my favorite C++ solution also.

    • @code_report
      @code_report  5 лет назад +2

      That's a great point. I totally agree - oversight on my part.

  • @dejavukun
    @dejavukun 5 лет назад +1

    Great to see you back! Waiting for your CPP journey video! I have been doing deep learning recently and I hope it can make it to NVidia in future.

  • @andyl.5998
    @andyl.5998 5 лет назад +3

    Great video as always!
    Summing booleans as integers would result in shorter code in python:
    sum( len(str(x)) % 2 == 0 for x in nums)

  • @coderguy339
    @coderguy339 5 лет назад

    Sir very nice
    Pls keep uploading such solution videos with brief discussion on core concept as well 😊
    Only u r helping struggling competitive coders 🙏🏻

  • @bojones11
    @bojones11 5 лет назад +1

    You’ve unlocked the code to my heart

    • @code_report
      @code_report  5 лет назад +3

      Don't "reduce" me to tears :p

  • @NonameBozo88
    @NonameBozo88 5 лет назад +3

    Stupid question , would just taking the log base 10 of the number and if it is odd be sufficient ? Not sure why mapping to strings was needed , good work for presentation, damn good to see , already subscribed 😀

    • @Vogel42
      @Vogel42 4 года назад

      I completely agree with you.

  • @eequalsmc2829
    @eequalsmc2829 5 лет назад

    Glad to see you back

  • @r.pizzamonkey7379
    @r.pizzamonkey7379 4 года назад

    Why do you convert to string and then count the length? Wouldn't it be better to take the floor of mod10?

  • @manikantabandla3923
    @manikantabandla3923 5 лет назад

    How can we come to know a problem should be solved in either O(n) or O(nlogn) or O(n^2) etc based on given memory and size constraints.
    Please help me out.

  • @the_cheese_cultist
    @the_cheese_cultist 3 года назад

    C#:
    input.Select(n => n.ToString().Length).Where(n => n%2==0).Count();
    or shorter but slower
    input.Select(n => n.ToString().Length).Count(n => n%2==0);

  • @jimmyjr.canosa
    @jimmyjr.canosa 3 года назад +1

    Where APL?

  • @pauloffborba
    @pauloffborba 4 года назад

    Great work!

  • @RishabhRD
    @RishabhRD 2 года назад

    Instead of accumulate you could have used transform_reduce where transform is (to_string(e).size()%2 == 0)

  • @DarshanSenTheComposer
    @DarshanSenTheComposer 5 лет назад +1

    I just hope CodeChef skips over C++17 and introduces C++20 :)

  • @prajulsahu9838
    @prajulsahu9838 3 года назад

    I'm getting runtime error

  • @mikeg9b
    @mikeg9b 5 лет назад

    Clojure looks nice.

  • @mechashadowx
    @mechashadowx 5 лет назад

    we miss you

    • @code_report
      @code_report  5 лет назад +4

      I'll be posting more frequently going forward :)