Lesson 32 of 34

HashMap: Key-Value সংরক্ষণ

10 min 35 XP

HashMap অভিধানের মতো প্রতিটি key-র জন্য একটি value রাখে এবং key দিয়ে খুব দ্রুত value খোঁজে। Keys অনন্য: একই key আবার put করলে তার value বদলে যায়।

Example: edit me and press Run

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

গোনা HashMap-এর ক্লাসিক ব্যবহার: map.put(w, map.getOrDefault(w, 0) + 1)। Keys sorted ক্রমে চাইলে TreeMap ব্যবহার করুন।

Example: edit me and press Run

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

Challenge

+35 XP

একটি lowercase শব্দ পড়ে প্রথম যে অক্ষর মাত্র একবার আসে তা print করুন। না থাকলে -1 print করুন। Input: swiss → Output: w

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