please give any hint for this question
XYZ Encryption question is a bit confusing
In this question you are given an encryption method of a string which consist of only three alphabets x,y,z
the encryption method converts a string into a unique graph having nodes from 1 to n, the encryption method states that there is a edge between two nodes u and v if s[u-1]=s[v-1] (as string are 0 indexed in c++) OR s[u-1] and s[v-1] are neighbouring characters .
what we have to do is , we are given a graph and we have to tell if there is a string which can form that graph under above conditions
in sample input we are given
3 1
1 2
here ,this graph can be generated from folowing strings : xxz , zzx
thus the output is yes
Some observations
- if in the graph : two nodes are not connected than one of them would be x and other will be z
- if a node is connected to two nodes that are not connected with each other than it will be y
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.