FastPrepCheck Anagrams
Problems/Check Anagrams

Check Anagrams

Deloitte logoDeloitte● EasyFULLTIMENEW GRADONSITE INTERVIEW

Updated Jul 2026

QuestionFunctionExamplesConstraints

Problem statement

You are given two strings s and t.

Determine whether the two strings are anagrams of each other. Two strings are anagrams if they contain exactly the same characters with the same frequencies, possibly in a different order.

Return 1 if the strings are anagrams, otherwise return 0.

Function

checkAnagrams(s: String, t: String) → int

Examples

Example 1

s = "listen"t = "silent"return = 1

listen and silent contain the same letters with the same frequencies.

Example 2

s = "race"t = "care"return = 1

race and care are anagrams.

Example 3

s = "hello"t = "world"return = 0

The two strings do not have matching character frequencies.

Constraints

  • s and t consist of printable characters.
  • The comparison is case-sensitive.

More Deloitte interview questions

  • Second-Highest Distinct SalaryPHONE SCREEN · Seen Jul 2026
  • Seventh Nearest PalindromeOA · Seen May 2026
  • Minimum Deletions for a Non-PalindromeOA · Seen Jul 2025
  • Minimum-Cost Solar Rooftop AllocationOA · Seen Jul 2025
  • Pair Elements with Even SumsOA · Seen Jul 2025
  • Count Divisible PermutationsOA · Seen Jan 2025
  • Largest Element in an ArrayOA · Seen Nov 2024
  • Install Carbon FiltersOA · Seen Oct 2023
  • Longest Substring with Even OccurrencesOA · Seen Oct 2023
  • Maximum Sum RectangleOA · Seen Apr 2022

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 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
  • Valid AnagramMotive · ONSITE INTERVIEWMotive interview questions
  • Anagram Words in a SentenceNutanix · ONSITE INTERVIEWNutanix interview questions
  • List Each Name Once, AlphabeticallyDocuSign · ONSITE INTERVIEWDocuSign interview questions

Deloitte interview experiences

  • Deloitte New Grad Tech OA and Interview Questions: 14 Experiences
All Deloitte interview questionsSee Deloitte hiring insights
Saved
class Solution {
    public int checkAnagrams(String s, String t) {
      // write your code here
    }
}
Checking account…