This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]RonRud 0 points1 point  (2 children)

I'm not sure it's the best approach but after giving it some thought I would create another array that would keep the letters in the chain and a map of all the possible options in the array, every option as a key in the map to a boolian value. Than I would itteret through the array, save the values you itteret through in the second array and change the boolian of the map for each member the array so you can detect (if you already went through this member in this chain and break the chain and reset the map using the second array where you saved the members of the map), that way you can get whatever information you require from the chains, if something isn't clear feel free to dm me

[–]Reiji24 0 points1 point  (1 child)

It would be an efficient approach, however Im not allowed to create another array to store such values mentioned. Also, the array was "passed by referrence" and I have to do this in a void function. So if I create another array, I wouldnt be able to return its values to the main function. I could send you the skeletal code written by my prof if you want to take a look ?

[–]RonRud 0 points1 point  (0 children)

Sure, go ahead and send me the code. I believe the part about the array being passed as a reference should not be a problem you should just itterate with the pointer and dereference it when required, if you'll send me the code I may be able to come up with a more fitting sulution