Optimizing space complexity using bitmasks (with Intuition)
\nbool checkIfPangram(string sentence) {\n\tint mask = 0;\n\tfor(char &c : sentence) mask |= (1 << (c - \'a\'));\n\treturn (1 + mask) == (1 << 26);\n}\n\n\nSpac
```\nbool checkIfPangram(string sentence) {\n\tint mask = 0;\n\tfor(char &c : sentence) mask |= (1 << (c - \'a\'));\n\treturn (1 + mask) == (1 << 26);\n}\n```\n\n**Space Complexity**\n*We can reduce our space complexity from* \n* **O( 26 * 4bytes (*int*) )** using set / hashset to\n* **O( 26 * 1byte (*bool*) )** using boolean array to\n* **O( 4bytes (*int*) )** using a single integer\n\n\n**Intuition**\n* A boolean array can be used to mark the characters which occur in the string.\n* The boolean values can be represented using bits of an integer.\n* Since there are only 26 characters, we can easily accomodate them inside the available 31 bits of an integer.\n\n\n**Advantage of integer over boolean array**\n* In order to check presence of characters in the boolean array, you have to use a loop of size 26.\n* For an integer, If all the characters are present, the integer will have 26 bits[0 - 25] set from its left end.\n* Adding another 1 to it will set the 26th bit and unset the bits on the right.\n*eg : 0111 + 1 = 1000*\n* Thus the condition can be checked in a single step, removing the need of a loop. (*please refer the source code*)
['Bit Manipulation', 'C', 'Bitmask']