Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
62 lines (53 loc) · 1.46 KB

File metadata and controls

62 lines (53 loc) · 1.46 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*Given a string check if it is Pangram or not. A pangram is a sentence containing every letter in the English Alphabet.
Example 1:
Input:
S = Bawds jog, flick quartz, vex nymph
Output: 1
Explantion: In the given input, there
are all the letters of the English
alphabet. Hence, the output is 1.
Example 2:
Input:
S = sdfs
Output: 0
Explantion: In the given input, there
aren't all the letters present in the
English alphabet. Hence, the output
is 0.
Your Task:
You need to complete the function checkPangram() that takes a string as a parameter and returns true if the string is a pangram, else it returns false.
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(Number of distinct characters).
Constraints:
1 <= |S| <= 104*/
import java.util.*;
class PangramCheck
{
public static void main (String[] args)
{
Scanner sc=new Scanner(System.in);
String str=sc.next();
int arr[]=new int[26];
for(int i=0;i<str.length();i++)
{
if(str.charAt(i)>='a'&&str.charAt(i)<='z')
{
arr[str.charAt(i)-'a']++;
}
else if(str.charAt(i)>='A'&&str.charAt(i)<='Z')
{
arr[str.charAt(i)-'A']++;
}
}
for(int i=0;i<26;i++)
{
if(arr[i]==0)
{
System.out.println("Not Pangram");
return;
}
}
System.out.println("Pangram");
sc.close();
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.