Learn from Leaders, Learn from ABC. Watch our latest technical videos in your language: For Hindi:- bit.ly/2TRuGVP For Kannada:- bit.ly/31NH63M For Telugu:- bit.ly/2MuYRRP For Tamil:- bit.ly/2Num5Hz
For those who have been trying to convert to lowercase will get a problem, arrays index out of bound....try to convert it into upper case, as the logic says.....y[i]-65..... as 65 is the Ascii value of A.....Thank you
Sir.. Thank you so much for so nice expalaination. U and your teaching style is great. And what I like the most is your energy and enthusiasm when you teach :)
Hello sir, Instead of taking array I took following approach, would you please let me know whether this is ideal approach or not.. public boolean isPangram(String string) { string.replace(" ",""); char y[] = string.toCharArray(); for(char i='A'; i
Hi Sourabh, We are glad to see a different approach. It would be more ideal with the following changes implemented in the code: 1. Firstly, after replacing the spaces in the input String, the replace() method would return a new String object without spaces. This newly obtained String object should be reassigned to the String reference variable. Since Strings are immutable in Java. string = string.replace(" ","");
really nice explanation sir, i actually have a doubt, y cant v assign an array from A to Z then v take the given string convert it to array and sort it. if the resulting sting array is equal to the previous one it will be a pangram. please tell me if i am wrong thank you.
65 is the starting index of the array.In order to get the respective index of an alphabet,you should perform [final index]-[initial index] and here the initial index is fixed,as ascii value of A is 65.
send.firefox.com/download/586bbda37b23812b/#Ui6pUtPjZd9CSrbV9MgoUA the link given above is the same code with little modification that works for camel case also. you can remove the commented lines to understand the code and logic better.
This source code will not gonna work if the given string is in CamelCase notation and thus generates an Exception "ArrayIndexOutofBound". Sir, I m a big fan of you. the way of your teaching is Awesome. Actually i always used to be afraid with JAVA. But now your videos pull me in and build an interest into it. And i m one of your student in ABC, BTM. Thank you so much sir for such kind of Stuffs.
In python its a 3-4 line program. def ispangram(str): alphabet = "abcdefghijklmnopqrstuvwxyz" for char in alphabet: if char not in str.lower(): return False Done... Power of python
What if we just took the original string ("the quick brown fox jumps over a lazy dog") and sort it using Array.sort() method and then initialize a string of all alphabets ("abcdefghijklmnopqrstuvwzyx") and just compare it with the orginal sorted string using Array.equals(original sorted string,string of alphabets). if they are equal then print pangram otherwise print non pangram. but the problem I faced that the original sorted string will contain repeated alphabets which leads to inequality with the string of alphabets. Can you please help me out? the cod is as follows: public class test { public static void main(String[] args) { String s1 = "the quick brown fox jumps over a lazy dog"; s1 = s1.replace(" ", ""); s1 = s1.toLowerCase(); String alphabets="abcdefghijklmnopqrstuvwxyz"; char[] c = s1.toCharArray(); char [] alpha=alphabets.toCharArray(); Arrays.sort(c); boolean result = Arrays.equals(c,alpha); if(result==true) { System.out.println("Pangram"); } else System.out.println("Non Pangram"); } }
Learn from Leaders, Learn from ABC.
Watch our latest technical videos in your language:
For Hindi:- bit.ly/2TRuGVP
For Kannada:- bit.ly/31NH63M
For Telugu:- bit.ly/2MuYRRP
For Tamil:- bit.ly/2Num5Hz
Because of your teaching only I got interest on coding sir ... Tq soo much
The way you teaches is really great sir.I request you to make videos on data structures it would become easier from your teaching.
For those who have been trying to convert to lowercase will get a problem, arrays index out of bound....try to convert it into upper case, as the logic says.....y[i]-65..... as 65 is the Ascii value of A.....Thank you
Very high quality editing.. im amazed. Which software you use?
Sir..
Thank you so much for so nice expalaination.
U and your teaching style is great.
And what I like the most is your energy and enthusiasm when you teach :)
sachin is god of cricket.you are god of teaching sir.please make videos on c and c++ programming language
Sir, please make videos on Dynamic programing and Graph algos....
Epic music, great job explaining, awesome editing, straight to the point! 10/10 !
Without any hesitation 10/10
Hello sir,
Instead of taking array I took following approach, would you please let me know whether this is ideal approach or not..
public boolean isPangram(String string)
{
string.replace(" ","");
char y[] = string.toCharArray();
for(char i='A'; i
Hi Sourabh,
We are glad to see a different approach. It would be more ideal with the following changes implemented in the code:
1. Firstly, after replacing the spaces in the input String, the replace() method would return a new String object without spaces. This newly obtained String object should be reassigned to the String reference variable. Since Strings are immutable in Java.
string = string.replace(" ","");
really nice explanation sir,
i actually have a doubt, y cant v assign an array from A to Z then v take the given string convert it to array and sort it. if the resulting sting array is equal to the previous one it will be a pangram.
please tell me if i am wrong
thank you.
what will you do about the repeated letters??
nice teaching with good presentation.
Very well explanation sir and ur way to teach is very good
what if we want to use lowercase letters? what will be the logic then?
Hai sir !!
Plz explain about System.exit(0) System.exit(-1) System.exit(1)
Exit(0) is successful termination from the program
Whereas exit(1) is forcefully terminated by programmer
Nicely explain
Getting ArrayIndexOutOfBoundsException.. please help me on this
Certainly, Kindly share the program code here. We will resolve the issue for you.
me also same problem how can solve it...
i got u convert the string into uppercase u got it..
Hi I am getting confusion how to subtract ASCII value
We insist you to trace the code on your own once. It will certainly help you understand the logic well.
sir your teaching style wonderful
Thanks for your appreciation. Keep Watching, Keep Learning.
Sir please make data structures videos. I am eagerly waiting for your videos on data structures.
Undoubtedly, We have a lot to offer to aspiring technocrats. An intense series on Data Structures & Algorithms will be released very soon. Stay tuned!
thank sir
i like the BGM
Thank You
Always glad to be of service!
Y we need to subtract by 65 oly.? Can we use other no to subtract.?
We should subtract with 65 only in order to get the index value of array a[index]..
65 is the starting index of the array.In order to get the respective index of an alphabet,you should perform [final index]-[initial index] and here the initial index is fixed,as ascii value of A is 65.
Please watch before vidoes in one of the video will encounter this ASCII table mam
it throws exception, array index out of bound exception
send.firefox.com/download/586bbda37b23812b/#Ui6pUtPjZd9CSrbV9MgoUA
the link given above is the same code with little modification that works for camel case also.
you can remove the commented lines to understand the code and logic better.
This source code will not gonna work if the given string is in CamelCase notation and thus generates an Exception "ArrayIndexOutofBound".
Sir, I m a big fan of you.
the way of your teaching is Awesome.
Actually i always used to be afraid with JAVA. But now your videos pull me in and build an interest into it.
And i m one of your student in ABC, BTM.
Thank you so much sir for such kind of Stuffs.
I got the Solution 😀.
@@anne_pandey You have to convert the String to Upper Case before copying the value to the array, then you will get the output.
CAN U plzzz MAKE TUTORIALS ALGORITHM??
Plzzzzzzzzzzz
In python its a 3-4 line program.
def ispangram(str):
alphabet = "abcdefghijklmnopqrstuvwxyz"
for char in alphabet:
if char not in str.lower():
return False
Done...
Power of python
Sir, make tutorials On Mathematical Algorithms, generally used in Competitive programming
Please explain in hindi because some students are weak in English.
#include
int main()
{
int i,j,c=0;
char a[100]="the quick brown fox jumps over a lazy dog";
for(i=0;i
Why break;
What if I not put break
What if we just took the original string ("the quick brown fox jumps over a lazy dog") and sort it using Array.sort() method
and then initialize a string of all alphabets ("abcdefghijklmnopqrstuvwzyx") and just compare it with the orginal sorted string using Array.equals(original sorted string,string of alphabets).
if they are equal then print pangram otherwise print non pangram.
but the problem I faced that the original sorted string will contain repeated alphabets which leads to inequality with the string of alphabets. Can you please help me out?
the cod is as follows:
public class test {
public static void main(String[] args) {
String s1 = "the quick brown fox jumps over a lazy dog";
s1 = s1.replace(" ", "");
s1 = s1.toLowerCase();
String alphabets="abcdefghijklmnopqrstuvwxyz";
char[] c = s1.toCharArray();
char [] alpha=alphabets.toCharArray();
Arrays.sort(c);
boolean result = Arrays.equals(c,alpha);
if(result==true)
{
System.out.println("Pangram");
}
else
System.out.println("Non Pangram");
}
}
coding ka Sandeep maheshwari
Glad you think so, Shaurya! Happy learning!