Anagram | Check whether two strings are Anagram of each other | Java

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

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

  • @coolguy2066
    @coolguy2066 ปีที่แล้ว +7

    It is the best anagram video I found on the internet. So clear. Great handwriting too.

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

    helped me alot confused about this problem and code given by my teacher is very complex thanks brother keep doing irt

  • @AmitYadav-nz5if
    @AmitYadav-nz5if ปีที่แล้ว +1

    please note that last line you wrote for printing anagram will print every now and then until loop becomes 0..so you can use if loop to print properly.

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

    Very informative tutorial about anagram. Thanks

  • @MamtaJaiswal-o6i
    @MamtaJaiswal-o6i 5 หลายเดือนก่อน

    Thank you so much for this tutorial .🤗

  • @TurboThrottle200Rider
    @TurboThrottle200Rider 7 หลายเดือนก่อน

    best explaination sir very easy and simply helpful

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

    Nice explanation 👏. I want to add one point, here the time complexity for the code you wrote is very high
    O(n) converting string to array
    2xO(nlog(n)) for sorting
    O(n)
    Overall i feel nlog(n) as time complexity

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

      ya he should go with Frequency array which will give t(n) around O(n)

  • @Shadow-pj9uv
    @Shadow-pj9uv 3 หลายเดือนก่อน

    helpful video thanks ..... we can also use hash Map to reduce the TC

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

    You explained it really well tbh. Next time please add the time complexity.

  • @RahulKumar-sx8hm
    @RahulKumar-sx8hm ปีที่แล้ว

    bro vedio is super plz do on more vedios on strings like removing duplicate elements in the strings etc

  • @SilentAngelD
    @SilentAngelD ปีที่แล้ว +4

    this program is showing error while executing🙄

  • @anantshukla6395
    @anantshukla6395 3 หลายเดือนก่อน

    Very nice explanation sir

  • @ShivamSingh-gc6pm
    @ShivamSingh-gc6pm ปีที่แล้ว

    Thankyou sir 😊
    Very helpful....

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

    Best one!

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

    bro i love you
    greetings from germany

  • @rachamallidorasrivignesh4499
    @rachamallidorasrivignesh4499 8 หลายเดือนก่อน

    Tq so much brother❤❤❤❤

  • @nawwintphyu1873
    @nawwintphyu1873 8 หลายเดือนก่อน

    Thank you!

  • @siyamali5978
    @siyamali5978 4 หลายเดือนก่อน

    Thank you

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

    Super bro

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

    Brother can you help me in the below question.
    Suppose a string id given "Today is sunday" and interviewer asked me to find day occures howmany times and at what position.(Hint: position must be of only "d" like 2,12 & without using built in methods)

    • @proxy5061
      @proxy5061 2 ปีที่แล้ว

      By built in method you can use like first;;;;
      String[] strngarr = strng.split(" ");
      Loop that words now , inside and check
      strng.indexOf("day")
      If user defined means
      Split and loop as shown above
      Inside loop
      Check for every sequence occurence of string day ,,, like
      For (){
      Str[i] == d
      str[i+1] == a
      str[i+2] == y
      This is just plane we have to enhance little bit u will get this inguess

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

    but after loop it will always print anagram string so what is the logic behind this

  • @Hitu619
    @Hitu619 9 หลายเดือนก่อน

    Bro,please give logic in mathematical approach of coding

    • @BTechComputerScience
      @BTechComputerScience  9 หลายเดือนก่อน +1

      Hi, coding is nothing but talking too computer, it's like asking the computer to do some task for u... so there is nothing like mathematical approach of coding. For some problems u need to understand maths to tell the computer how to solve it.
      Not all coding problem requires maths... coding requires logical thinking and problem solving.
      Hope u can now strengthen those things and grow😊

    • @Hitu619
      @Hitu619 9 หลายเดือนก่อน

      @@BTechComputerScience kk bro

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

    Best

  • @BharathKumar-nf6xt
    @BharathKumar-nf6xt ปีที่แล้ว

    Why cant we use equal() method bro..

  • @ankurrunthala
    @ankurrunthala 2 ปีที่แล้ว

    Gajab

  • @saibaba369
    @saibaba369 2 ปีที่แล้ว

    Nice

  • @KatikaAmrutha-vd2xe
    @KatikaAmrutha-vd2xe 7 หลายเดือนก่อน

    For me Arrays.sort(c1);
    Arrays.sort(c2);
    Showing error

    • @nirajvarma-z7d
      @nirajvarma-z7d 3 หลายเดือนก่อน

      import java.util.Arrays paste this at the starting

  • @rupasrithati8960
    @rupasrithati8960 2 ปีที่แล้ว

    Why char to chararray

    • @Notfound.5019
      @Notfound.5019 2 ปีที่แล้ว +1

      Strings doesn't have a built-in sort method but charArray does!!
      so we convert the string into charArray and apply the methods

  • @AmitYadav-nz5if
    @AmitYadav-nz5if ปีที่แล้ว +1

    Here i the corrected code from my end
    import java.util.Arrays;
    public class Anagram_or_not
    {
    public static void main(String[] args)
    {
    String str1 = "SILENT";
    String str2 = "LISTEN";
    char ch1[] = str1.toCharArray();
    char ch2[]= str2.toCharArray();
    boolean status = false;
    Arrays.sort(ch1);
    Arrays.sort(ch2);
    if (ch1.length!= ch2.length)
    {
    System.out.println("Not an Anagram Because length is not same");

    }
    for (int i=0;i< ch1.length;i++)
    {
    if (ch1[i]!=ch2[i])
    {
    System.out.println("Not An Anagram");
    status=false;
    break;
    }
    }
    if (status!=true)
    {
    System.out.println("It is An Anagram");
    }
    }
    }