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

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

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

  • @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

  • @districte7177
    @districte7177 Год назад

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

  • @Shadow-pj9uv
    @Shadow-pj9uv 3 месяца назад

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

  • @TurboThrottle200Rider
    @TurboThrottle200Rider 8 месяцев назад

    best explaination sir very easy and simply helpful

  • @MamtaJaiswal-o6i
    @MamtaJaiswal-o6i 6 месяцев назад

    Thank you so much for this tutorial .🤗

  • @RahulKumar-sx8hm
    @RahulKumar-sx8hm Год назад

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

  • @rachamallidorasrivignesh4499
    @rachamallidorasrivignesh4499 9 месяцев назад

    Tq so much brother❤❤❤❤

  • @anantshukla6395
    @anantshukla6395 4 месяца назад

    Very nice explanation sir

  • @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)

  • @SilentAngelD
    @SilentAngelD Год назад +3

    this program is showing error while executing🙄

  • @ShivamSingh-gc6pm
    @ShivamSingh-gc6pm Год назад

    Thankyou sir 😊
    Very helpful....

  • @siyamali5978
    @siyamali5978 4 месяца назад

    Thank you

  • @pshpshh2845
    @pshpshh2845 Год назад

    bro i love you
    greetings from germany

  • @whyu8012
    @whyu8012 2 года назад +1

    Super bro

  • @nawwintphyu1873
    @nawwintphyu1873 8 месяцев назад

    Thank you!

  • @knowledgegetter
    @knowledgegetter Год назад

    Best one!

  • @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

  • @BharathKumar-nf6xt
    @BharathKumar-nf6xt Год назад

    Why cant we use equal() method bro..

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

    Nice

  • @Hitu619
    @Hitu619 10 месяцев назад

    Bro,please give logic in mathematical approach of coding

    • @BTechComputerScience
      @BTechComputerScience  10 месяцев назад +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 10 месяцев назад

      @@BTechComputerScience kk bro

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

    Gajab

  • @prasadpatil4016
    @prasadpatil4016 Год назад

    Best

  • @KatikaAmrutha-vd2xe
    @KatikaAmrutha-vd2xe 8 месяцев назад

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

    • @nirajvarma-z7d
      @nirajvarma-z7d 4 месяца назад

      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");
    }
    }
    }