Skip to main content

Posts

Two Pointers:- Valid Palindrome

Recent posts

Arrays & Hashing:- Valid Anagram | Two Sum | Group Anagrams

Valid Anagram Given two strings s and t, return true if t is an anagram of s, and false otherwise. Example 1: Input: s = "anagram", t = "nagaram" Output: true Example 2: Input: s = "rat", t = "car" Output: false Solution : class Solution ( object ):     def isAnagram ( self , s , t ):         """         :type s: str         :type t: str         :rtype: bool         """         if len (s)!= len (t):             return False                 countS, countT= {},{}         for i in range ( len (s)):             countS[s[i]]= 1 + countS.get(s[i], 0 )             countT[t[i]]= 1 + countT.get(t[i], 0 )                 return countS == countT         T...