Dsa
Hashing
Medium
Reconstruct String from Fingerprints
A fingerprint represents a unique set of characters found in a string. Given a list of fingerprints (strings with no duplicate characters), reconstruct possible original strings by concatenating the fingerprints. Each character from the fingerprints can only appear once in the original string, and the output should be sorted lexicographically.
Input Format:
First line contains an integer N, the number of fingerprints. The next N lines each contain one fingerprint (a string where all characters are unique).
Output Format:
Print all possible original strings sorted lexicographically, each on a new line.
Example:
Input:
3
abc
d
efg
Output:
abcde
abcfg
abdec
abfge
...
Key concepts
hashingstringsreconstruction
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now