bhaiya gave h.w to printf reduce string i cant able to get the logic .
printing its coordinate like x,y i got it anybody please help
Shortest path string reducing string length
Hello @Diwyanshu
I will give an example to clear your understanding of what to do in this question.
Example
NNNNWWSSEEWWE
So you start at (0, 0)
For each N you go one unit UP
For each S you go one unit DOWN
For each E you go one unit RIGHT
For each W you go one unit LEFT
So for NNNNWWSSEEWWE you final location will be
(-1, 2)
You can also reach the same location by the string WNN which is the reduced string
You need to print this reduced string from (-1, 2).
You can simply cancel one E for one W and one N for one S and print the rest of the string.
i cant able to get how can i reduce the string a small code would help.
thanks for fast reply @prashuk156 bhaiya
please i cant understand
@prashuk156
“You can also reach the same location by the string WNN which is the reduced string
You need to print this reduced string from (-1, 2)”
Hello @Diwyanshu
Here is the code
If you still need any help, leave a reply and I will help you out.