Leetcode 1027 Longest Arithmetic Subsequence

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

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

  • @shreyashtripathi1187
    @shreyashtripathi1187 10 หลายเดือนก่อน

    Wow very simply and beautifully explained!

  • @cadcaetutorial2039
    @cadcaetutorial2039 ปีที่แล้ว +2

    So nice this lecture sir

  • @Star_Bawa9
    @Star_Bawa9 ปีที่แล้ว +2

    i think of a better solution let us say m1-m2 =diff then m1-diff =m2 this means if we use a map and find the m2 element in the map we increase its frequency (curr-diff)+1 else we initialize it to one and just store the count of element with maxfreq in an variable and return it .
    Here is the code
    class Solution {
    public int longestSubsequence(int[] arr, int difference) {
    Map map=new HashMap();
    int mx=0;
    for(int i=0;i

  • @pavanranjith9884
    @pavanranjith9884 ปีที่แล้ว +1

    Doing Good Brother.. Keep going!

  • @leetcoder1159
    @leetcoder1159 ปีที่แล้ว +1

    Which text editor you use for writing?

  • @bogdyee
    @bogdyee ปีที่แล้ว

    Found the same problem a while ago but with limitations like this 2 < n < 10000, 1

  • @cadcaetutorial2039
    @cadcaetutorial2039 ปีที่แล้ว +2

    This lecture is very nice sir

  • @thisismrsanjay
    @thisismrsanjay ปีที่แล้ว +2

    really nice explanation please if possible make a video on all the imp patterns in arrays thanks ❤❤

    • @JeevanKumar-code
      @JeevanKumar-code  ปีที่แล้ว

      Sure. I am planning to come up with a course! Stay tuned! Welcome❤️

  • @mohammadyahya78
    @mohammadyahya78 ปีที่แล้ว +1

    Very smart solutions. Thank you.

  • @MertMusaTemel
    @MertMusaTemel ปีที่แล้ว +1

    thanks for the explanation

  • @146_shashanks4
    @146_shashanks4 ปีที่แล้ว +1

    very nice explanation bro😊