Isomorphic Strings

Read the lesson → understand the pattern → then code. Tutor works offline (built-in teacher); optional Cursor/Gemini keys upgrade chat quality.

Topic refresher: Hashing — Pay Space, Buy Time

Replace nested loops with unordered_map / unordered_set lookups.

unordered_map<int,int> mp;
for (int i = 0; i < n; i++) {
    int need = target - nums[i];
    if (mp.count(need)) return {mp[need], i};
    mp[nums[i]] = i;
}
Hashing

Isomorphic Strings

Easy
LeetCode
6/8
EasyHashingLeetCode #205

Isomorphic Strings

Bijection between characters of s and t. Two maps (or map + set).

Examples

Example 1

Input

egg add

Output

true
Example 2

Input

foo bar

Output

false

Stuck? Take a nudge

C++17