Check Anagrams
Updated
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) → intExamples
Example 1
s = "listen"t = "silent"return = 1listen and silent contain the same letters with the same frequencies.
Example 2
s = "race"t = "care"return = 1race and care are anagrams.
Example 3
s = "hello"t = "world"return = 0The two strings do not have matching character frequencies.
Constraints
sandtconsist of printable characters.- The comparison is case-sensitive.
More Bloomberg LP Phone Screen questions
- Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
- Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
- Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
- Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
Similar questions at other companies
- Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
- Count Adjacent Symbol Pairs for BPEAmazon · ONSITE INTERVIEW
- Portfolio Valuation, Part 1Stripe · PHONE SCREENStripe interview questions
- Map and Accumulate Learning QueriesPalantir · ONSITE INTERVIEWPalantir interview questions
- Summarize Server Healthcheck LogsNVIDIA · PHONE SCREENNVIDIA interview questions
- Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
- Best Anagram MatchGoogle · PHONE SCREENGoogle interview questions
- Filter Anagrams of a TargetMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
- Word Frequency in a Large TextRobinhood · PHONE SCREENRobinhood interview questions
- Check AnagramsDeloitte · ONSITE INTERVIEWDeloitte interview questions