You are viewing a single comment's thread. Return to all comments →
My Solution in Java with bit manipulation
Scanner s = new Scanner(System.in); String text = s.nextLine(); int allLetters = Integer.parseInt("11111111111111111111111111",2); int currentLetter = 0; for(int i=0; i<text.length(); i++){ char c = Character.toLowerCase(text.charAt(i)); if(Character.isLowerCase(c)){ currentLetter = currentLetter | 1 << (Integer.valueOf(c-97)); if(currentLetter == allLetters){ System.out.println("pangram"); return; } } } System.out.println("not pangram");
Pangrams
You are viewing a single comment's thread. Return to all comments →
My Solution in Java with bit manipulation