Click here to Skip to main content
15,886,823 members

Comments by Member 15047625 (Top 47 by date)

Member 15047625 12-Sep-22 7:57am View    
Ok thats smart. I have already did it on my own but it's definitely suboptimal - iterate through collection (except first and last element) and pick them with certain probability. Once selected, skip next adjacent element. If enough items have been selected exit, if not enough finish the job and get the rest by brute force without randomness (while respecting constraints).
Member 15047625 15-Mar-22 6:48am View    
This is solution for subset sum problem. I'm unsure how to convert it to my problem, and I hoped someone has any ideas.
Member 15047625 9-Mar-22 13:31pm View    
Your new version seems to work but I have to fully confirm it.
Empty string ε (also known as "", string.Empty, string of length 0) works like this: B = {"", "a"} C = {"a", "b"} => A = {"a", "b", "aa", "ab"}. A can be composed of these B and C, and we need to guess if such composition is possible or not. string.Empty + string = string. "" + "something" = "something".
Edit
Still doesn't work. https://onlinegdb.com/JvhxzTZ_g "" "a" "b" "aa" "ba" returns false, should be true.
Member 15047625 9-Mar-22 12:24pm View    
Pastebin data should return true. Which means it doesn't work at all.
I do appreciate your help but it seems we achieved nothing in the end.
Member 15047625 9-Mar-22 11:50am View    
Your c++ code run on onlinegdb.com returns true for set "", "a", "ab", which is incorrect, should return false. Link: https://onlinegdb.com/70yxdwKE6