FastPrepMost and Least Frequent Characters
Problems/Most and Least Frequent Characters

Most and Least Frequent Characters

Adobe logoAdobe● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: You find the most frequent and the least frequent character of a string. Ties go to the character that shows up first. A report for a software quality engineer role at Adobe (November 2023, offer accepted) lists seven rounds. The first was on DSA and coding and had two coding questions, and this was the first of them. The report gives the task in one line. It has no alphabet, tie rule, output form, limits or examples.

We chose these rules. Only characters present in the string count. Case matters. The string holds letters and digits and is at most 5 * 10^4 long. Ties go to the character whose first appearance is earliest. The answer is returned as a pair. We wrote new examples.

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

Given a string s, find the character that occurs most often in it and the character that occurs least often. Only characters that appear in s count, and upper and lower case letters are different characters.

If several characters share the highest count, pick the one whose first appearance in s comes earliest. Break ties for the lowest count the same way.

Return [most, least], each as a one-character string.

Function

mostAndLeast(s: String) → String[]

Examples

Example 1

s = "kettle7tea"return = ["e","k"]

Counts: t 3, e 3, k 1, l 1, 7 1, a 1. t and e tie for the most; e appears first (index 1), so it wins. Four characters tie for the least; k appears first (index 0).

Example 2

s = "Zoozoo"return = ["o","Z"]

Upper and lower case are different characters: o appears 4 times, Z and z once each. Z appears before z, so it is the least frequent.

Example 3

s = "88"return = ["8","8"]

Only one distinct character, so it is both the most and the least frequent.

Constraints

  • 1 <= s.length <= 5 * 10^4
  • s consists of English letters (upper and lower case) and digits.

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Detect a Straight FlushTemu · PHONE SCREENTemu interview questions
  • First Letter to Appear TwiceCisco · PHONE SCREENCisco interview questions
  • Halfway Course in a Single TrackCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Portfolio Valuation, Part 1Stripe · PHONE SCREENStripe interview questions
  • Single-Condition Product FilterCrowdstrike · PHONE SCREENCrowdstrike interview questions
  • Summarize Server Healthcheck LogsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Known Words Matching Phone DigitsLinkedIn · PHONE SCREENLinkedIn interview questions
  • First Non-Repeated CharacterDell Technologies · PHONE SCREENDell Technologies interview questions
  • Convert an Entry List to a MapEPAM · PHONE SCREENEPAM interview questions
  • First Non-Repeating CharacterGoldman Sachs · PHONE SCREEN · ONSITE INTERVIEWGoldman Sachs interview questions

Interview reports that mention this question

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)

Adobe interview experiences

  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
  • Adobe Product Intern Interviews: 15 Experiences (Part 3 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public String[] mostAndLeast(String s) {
        // Write your code here.
    }
}
Checking account…