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

preview_player
Показать описание

Subscribe to my channel so that you do not miss any topics.

My other videos-
Рекомендации по теме
Комментарии
Автор

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

coolguy
Автор

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

thebrothers
Автор

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.

AmitYadav-nzif
Автор

Very informative tutorial about anagram. Thanks

NZIT
Автор

Thank you so much for this tutorial .🤗

MamtaJaiswal-oi
Автор

best explaination sir very easy and simply helpful

Motoraddictz_mehkma
Автор

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

RahulKumar-sxhm
Автор

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

districte
Автор

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

thahirThavvagunta
Автор

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

Shadow-pjuv
Автор

bro i love you
greetings from germany

pshpshh
Автор

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)

faizalyakub
Автор

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

amitamishra
Автор

this program is showing error while executing🙄

SilentAngelD
Автор

Bro, please give logic in mathematical approach of coding

Hitu
Автор

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

KatikaAmrutha-vdxe
Автор

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

AmitYadav-nzif
visit shbcf.ru