How to concatenate the strings .I am getting compile time error in solving this. How can I resolve this issue?
Algorithm:
1.We will solve this problem through recursion.
2.So, iterate from left to right and try every string as a starting string.
3.Keep a set of character that stores characters that have occurred till now.
4.Once,you have selected a string as a starting string,now for every other string you have 2 options:
a.To add that string(only if all its characters have not occurred before) and add its character to set of current characters.
b.To leave that string
5.Try the same for all string and finally return maximum of them.
refer this code https://ide.codingblocks.com/s/596933
But, why are we considering it using entire strings we have to look into individual characters? If the example contains two strings ab and ac our output string should be abc and length must be 3 na?
2
ab
ac
for this input o/p will be 2… we cant remove characters from a particular string… all we have to do is find all the strings in the input such that they have unique characters… we cant remove characters from string is what is stated in question…
hope it clears ur doubts
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.
Yes, I solved the code using C++, but I want to unlock editorial to check Java code. Will it decrease my score? because it was mentioned like if you unlock the editorial you won’t be awarded any score to this problem?
if u have submitted ur code… then it wont affect ur score… but if u unlock before submitting then u wont get ant points
In the editorial I could see only C++solution. Can you provide Java code for this problem for reference as I want to learn Java simultaneously.
Hi @gvspraveen113… I take doubts only in c++ and dont code in java… so i cant provide u with java solution… hope u understand…
Oh okay … Can I contact anyone who can code in Java for help ?Because in the videos ,the main function in Java was not explained or can’t be seen…
if u are learning java then its only syntax only… logic remains the same… so maybe u can try it a bit later when u have better hold of java