PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCareers
|Home/Coding & Algorithms/Amazon

Sort characters by frequency

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's understanding of frequency counting, custom sorting with lexicographic tie-breaking, string manipulation, and time/space complexity analysis. It is commonly asked in the Coding & Algorithms domain to assess practical algorithmic implementation and efficiency trade-offs, and it primarily tests practical application rather than purely conceptual understanding.

  • Medium
  • Amazon
  • Coding & Algorithms
  • Software Engineer

Sort characters by frequency

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Given an ASCII string s, reorder its characters in decreasing order of frequency. If multiple characters share the same frequency, break ties by ascending lexicographic order. Return the resulting string. Analyze time and space complexity and provide code.

Quick Answer: This question evaluates a candidate's understanding of frequency counting, custom sorting with lexicographic tie-breaking, string manipulation, and time/space complexity analysis. It is commonly asked in the Coding & Algorithms domain to assess practical algorithmic implementation and efficiency trade-offs, and it primarily tests practical application rather than purely conceptual understanding.

Related Interview Questions

  • Find Valid IP Addresses in Files - Amazon (medium)
  • Implement Optimal Bucket Batching - Amazon (hard)
  • Implement Cache and Rotate Matrix - Amazon (medium)
  • Find Longest Activatable Server Streak - Amazon (hard)
  • Build the Largest Available Sequence - Amazon (medium)
Amazon logo
Amazon
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0

Given an ASCII string s, reorder its characters in decreasing order of frequency. If multiple characters share the same frequency, break ties by ascending lexicographic order. Return the resulting string. Analyze time and space complexity and provide code.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

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

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

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • Careers
  • 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.