- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
An Anagram I Am in Python
Suppose we have two strings s0 and s1, we have to check whether they are anagrams of each other or not. As we know two strings are said to be anagrams when we can rearrange one to become the other.
So, if the input is like s0 = "listen", s1 = "silent", then the output will be True.
To solve this, we will follow these steps −
sort the characters of s0 and s1
if sorted sequence of characters of s0 and s1 are same, then
otherwise return False
Let us see the following implementation to get better understanding −
class Solution: def solve(self, s0, s1): return sorted(s0) == sorted(s1) ob = Solution() print(ob.solve("listen", "silent"))
- Valid Anagram in Python
- Why am i getting error with System.out.println?
- What is an anagram in C language?
- Anagram Substring Search using Python
- Anagram checking in Python using collections.Counter()
- I am just try to make a chat bot
- Anagram checking in Python program using collections.Counter()
- Python Program for Anagram Substring Search
- In college, if I am being ragged by my seniors, whom should I complain?
- Despite being rich, why am I not able to get happiness?
- Anagram Pattern Search
- Why am I not getting the desired results despite working very hard?
- Program to find length of longest anagram subsequence in Python
- I have SAP UI5 application that I am not able to start after adding to SAP Fiori Launchpad.
- Why I am facing a problem using the field 'from' in SQL query?