Easy Java Solution using HashSet Two Approaches
Approach 1\n1. Initialize HashSet:\n   - Create a HashSet<Character> mp to store unique characters from the sentence.\n\n2. Add Characters to HashSet:\n   - Ite
# Approach 1\n1. **Initialize HashSet**:\n   - Create a `HashSet<Character> mp` to store unique characters from the sentence.\n\n2. **Add Characters to HashSet**:\n   - Iterate through each character in the `sentence`.\n   - Add each character to the `HashSet`.\n\n3. **Check for Pangram**:\n   - Iterate through all lowercase English letters from \'a\' to \'z\'.\n   - For each letter, check if it is contained in the `HashSet`.\n   - If any letter is not found in the `HashSet`, return `false`.\n\n4. **Return True**:\n   - If all letters \'a\' to \'z\' are found in the `HashSet`, return `true`.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\n    public boolean checkIfPangram(String sentence) {\n        HashSet<Character> mp=new HashSet<>();\n        for(int i=0; i<sentence.length(); i++){\n            mp.add(sentence.charAt(i));\n        }\n        for(char i=\'a\'; i<=\'z\'; i++){\n            if(!mp.contains(i)) return false;\n        }\n        return true;\n    }\n}\n```\n\n# Approach 2\n1. **Initialize HashSet**:\n   - Create a `HashSet` named `mp` to store characters.\n\n2. **Iterate Over Sentence**:\n   - Loop through each character in the input `sentence`.\n   - For each character, add it to the `HashSet`.\n\n3. **Check Pangram Condition**:\n   - After the loop, check the size of the `HashSet`.\n   - If the size of the `HashSet` is 26 (i.e., all 26 letters of the English alphabet are present), return `true`.\n   - Otherwise, return `false`.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\n    public boolean checkIfPangram(String sentence) {\n        HashSet<Character> mp=new HashSet<>();\n        for(int i=0; i<sentence.length(); i++){\n            mp.add(sentence.charAt(i));\n        }\n        return mp.size() == 26;\n    }\n}\n```\n\n![193730892e8675ebafc11519f6174bee5c4a5ab0.jpeg](https://assets.leetcode.com/users/images/75f8e829-9bfb-44ed-9631-b3acd1b1a04f_1718520360.6509528.jpeg)\n
['Java']