https://algo.monster/problems/max_length_of_a_concatenated_string_with_unique_characters
Maximum Length of a Concatenated String with Unique Characters - Company-specific OAs / Microsoft OA
Hello! Please correct me if I am wrong, but isn’t line 27 for the Java solution incorrect?
For Line 27 we have maxLen = dfs(arr, path + arr.get(j), j + 1, maxLen, mem);
But shouldn’t it actually be maxLen = Math.max(maxLength, dfs(arr, path + arr.get(j), j + 1, maxLen, mem)); ?
Otherwise maxLen will get overriden everytime, even if the length returned from maxLen is not larger than the current maxLen.
All of the test cases do still pass with the current solution, but that just seemed off to me.