Lesson 24 of 34
Characters మరియు ASCII
9 min 30 XP
ప్రతి char కు ఒక సంఖ్య ఉంటుంది (దాని ASCII/Unicode code): 'A' = 65, 'a' = 97, '0' = 48. కాబట్టి chars తో లెక్కలు చేయవచ్చు: 'a' + 1 అంటే 'b'.
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.26 size ఉన్న int array తో అక్షరాల frequency లెక్కించండి: count[ch - 'a']++. ఈ trick anagram, first-non-repeating-character ప్రశ్నలను పరిష్కరిస్తుంది.
Example: edit me and press Run
Output Loading Java (first time takes a few seconds)
Press Run to see the result here.