Uncommon Characters Problem Statement

Given two strings str1 and str2 containing only lowercase alphabets, find the characters that are unique to each string, i.e., characters that occur in only one of the strings and not in both.

Return these uncommon characters in lexicographically sorted order.

Example:

Input:
str1 = "characters", str2 = "alphabets"
Output:
"bchlr"
Explanation:

The uncommon characters are 'b', 'c', 'h', 'l', and 'r'.

Constraints:

  • 1 <= T <= 10
  • 1 <= |str1|, |str2| <= 50000
  • The input strings contain only lowercase alphabets.

Note:

You do not need to handle input/output operations; just implement the function to compute the answer.

AnswerBot
4mo

Find uncommon characters in two strings and return them in lexicographically sorted order.

  • Iterate through each character in both strings and keep track of their frequency using a hashmap.

  • Iterate throu...read more

Help your peers!
Select
Add answer anonymously...

SAP Developer Associate interview questions & answers

A Developer Associate was asked 2mo agoQ. Have you worked with CDS views and implemented the RAP framework?
A Developer Associate was asked Q. What are binary trees?
A Developer Associate was asked Q. Design a calculator that performs operations on 128-bit integers.

Popular interview questions of Developer Associate

A Developer Associate was asked Q1. What are binary trees?
A Developer Associate was asked Q2. Design a calculator that performs operations on 128-bit integers.
A Developer Associate was asked Q3. How to reverse a linked list and write program to get right view of a binary tre...read more
SAP Developer Associate Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits