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.

Challenge

+30 XP

രണ്ട് lowercase വാക്കുകൾ വായിക്കൂ. രണ്ടിലും കൃത്യമായി അതേ അക്ഷരങ്ങൾ അത്രയും തവണ ഉണ്ടെങ്കിൽ "Anagram", അല്ലെങ്കിൽ "Not anagram" print ചെയ്യൂ. Input: listen silent → Output: Anagram

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.