FastPrepValid Anagram
Problems/Valid Anagram

Valid Anagram

Motive logoMotive● EasyFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand Motive coding-round report for a full-time onsite interview links the well-known Valid Anagram problem.

Our version is about 99% the same as the reported question.

Given two lowercase English strings s and t, return true if t is an anagram of s, and false otherwise.

Function

isAnagram(s: String, t: String) → boolean

Examples

Example 1

s = "anagram"t = "nagaram"return = true

Example 2

s = "rat"t = "car"return = false

Constraints

  • 0 <= s.length, t.length <= 100000.
  • Both strings contain lowercase English letters only.

More Motive Onsite Interview questions

  • Group AnagramsPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
  • Longest Equal-Zero-One SubarrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
  • Maximum Weighted Sum After Left RotationsONSITE INTERVIEW · Seen Jan 2026
  • Valid Parenthesis StringPHONE SCREEN · ONSITE INTERVIEW · Seen Jan 2026
  • Best Time to Buy and Sell StockONSITE INTERVIEW · Seen Dec 2025
  • Target Triplet SumONSITE INTERVIEW · Seen Dec 2025
  • Validate IP AddressONSITE INTERVIEW · Seen Dec 2025
  • Generate Palindromic PermutationsONSITE INTERVIEW · Seen Dec 2025
  • Minimum Swaps to Group Circular OnesONSITE INTERVIEW · Seen Dec 2025
  • Staircase Search In A Sorted MatrixONSITE INTERVIEW · Seen Dec 2025

Similar questions at other companies

  • Count Adjacent Symbol Pairs for BPEAmazon · ONSITE INTERVIEW
  • Map and Accumulate Learning QueriesPalantir · ONSITE INTERVIEWPalantir interview questions
  • Filter Anagrams of a TargetMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Deduplicate Logs: Keep FirstGoogle · ONSITE INTERVIEWGoogle interview questions
  • Check AnagramsDeloitte · ONSITE INTERVIEWDeloitte interview questions
  • Check AnagramsBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Check Anagram Pairs Index by IndexExpedia · ONSITE INTERVIEWExpedia interview questions
  • Recursive Character FrequencyPalo Alto Networks · ONSITE INTERVIEWPalo Alto Networks interview questions
  • Anagram Words in a SentenceNutanix · ONSITE INTERVIEWNutanix interview questions
  • List Each Name Once, AlphabeticallyDocuSign · ONSITE INTERVIEWDocuSign interview questions
All Motive interview questionsSee Motive hiring insights
Saved
class Solution {
    public boolean isAnagram(String s, String t) {
      // write your code here
    }
}
Checking account…