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.