Coding Quiz - Detecting Anagrams
An anagram is when you can rearrange one string to form another.
For example, rearranging the letters of listen
can form the word silent
, making these two strings anagrams.
In this coding problem, you need to write a function that determines whether two given strings are anagrams
.
The function should take two strings as input and return True
if they are anagrams of each other, otherwise return False
.
Write Code
def solution(str1, str2): # Write your code here return
Constraints
-
Input strings contain only lowercase alphabets.
-
The length of a string is between 1 and 100 inclusive.
Example Input and Output
-
Input:
"listen"
,"silent"
-
Output:
True
-
Input:
"triangle"
,"integral"
-
Output:
True
Lecture
AI Tutor
Publish
Design
Upload
Notes
Favorites
Help