Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Implement a function that checks if a given string is an anagram of another string.

Medium

Problem Statement

Implement a function that checks if a given string is an anagram of another string.

Sample Input

str1 = "listen", str2 = "silent"

Sample Output

true

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
// Check if two strings are anagrams function areAnagrams(str1, str2) { } console.log(areAnagrams("listen", "silent"));
Log in or sign up to run or submit your code.Log inSign up
Input
str1 = "listen", str2 = "silent"
Expected Output
true