PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Salesforce

Design O(nm) grouping of rearranged strings

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of string manipulation, hashing and frequency-count techniques, algorithmic optimization, and time/space complexity analysis when grouping anagrams.

  • Medium
  • Salesforce
  • Coding & Algorithms
  • Software Engineer

Design O(nm) grouping of rearranged strings

Company: Salesforce

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Given an array of strings, group together words that are permutations of the same characters. Provide a baseline solution that sorts each word (O(n · m log m), where n is the number of words and m is max word length). Then, under assumptions such as inputs consist only of lowercase 'a'–'z', design an O(n · m) solution using character-frequency hashing. Specify how you construct a stable key (e.g., serialized counts), handle collisions, and analyze time and space trade-offs versus sorting.

Quick Answer: This question evaluates a candidate's understanding of string manipulation, hashing and frequency-count techniques, algorithmic optimization, and time/space complexity analysis when grouping anagrams.

Related Interview Questions

  • Solve Two OA Coding Problems - Salesforce (medium)
  • Maximize events attended given date ranges - Salesforce (medium)
  • Implement common data-structure and JS tasks - Salesforce (medium)
  • Minimize operations to reduce integer to zero - Salesforce (medium)
  • Implement an LFU cache with O(1) operations - Salesforce (medium)
Salesforce logo
Salesforce
Aug 1, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
7
0

Given an array of strings, group together words that are permutations of the same characters. Provide a baseline solution that sorts each word (O(n · m log m), where n is the number of words and m is max word length). Then, under assumptions such as inputs consist only of lowercase 'a'–'z', design an O(n · m) solution using character-frequency hashing. Specify how you construct a stable key (e.g., serialized counts), handle collisions, and analyze time and space trade-offs versus sorting.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Salesforce•More Software Engineer•Salesforce Software Engineer•Salesforce Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.