Lesson 24 of 34
Characters மற்றும் ASCIICharacters and ASCII
9 min 30 XP
ஒவ்வொரு char-க்கும் ஒரு எண் மதிப்பு (ASCII/Unicode) உண்டு: 'A' = 65, 'a' = 97, '0' = 48. ஆகவே char-களுடன் கணக்கிடலாம்: 'a' + 1 = 'b'.
Every char has a number (its ASCII/Unicode code): 'A' = 65, 'a' = 97, '0' = 48. So you can do maths with chars: 'a' + 1 is 'b'.
Example: edit me and press Run
Press Run to see the result here.எழுத்துகளின் எண்ணிக்கையை (frequency) எண்ண 26 அளவுள்ள int array பயன்படுத்தலாம்: count[ch - 'a']++. Anagram, முதல் repeat ஆகாத எழுத்து போன்ற கேள்விகளுக்கு இதுவே வழி.
Count letter frequencies with an int array of size 26: count[ch - 'a']++. This trick solves anagram and first-non-repeating-character questions.
Example: edit me and press Run
Press Run to see the result here.