Solved LeetCode program · 899 of 1,000
#1239 · Maximum Length of a Concatenated String with Unique Characters
Original English source
Keep a shared words holding "un", "iq", and "ue". Keep a shared alphabet as empty text. Place "abcdefghijklmnopqrstuvwxyz" into alphabet. Keep a shared letter of 0. Keep a shared found of 0. Keep a shared masks as an empty list of whole numbers. Keep a shared usable as an empty list of whole numbers. Place 0 into masks. Place 0 into masks. Place 0 into masks. Place 0 into usable. Place 0 into usable. Place 0 into usable. Keep a shared chosen of 0. Keep a shared best of 0.
To Locate from index (a whole number). If index is more than 25, set found to -1, return. The symbol is character index of alphabet. If symbol is letter, set found to index, return. Locate from index plus 1.
To Weigh from bit (a whole number) with total (a whole number). If bit is more than 25 and total is more than best, set best to total. If bit is more than 25, return. The place is shift 1 left by bit. The overlap is bitwise and of chosen and place. If overlap is more than 0, Weigh from bit plus 1 with total plus 1. If overlap is 0, Weigh from bit plus 1 with total.
To Finish with picked (a whole number). Set chosen to picked. Weigh from 0 with 0.
To Take from spot (a whole number) with picked (a whole number). The mixed is exclusive or of picked and item spot of masks. Gather from spot plus 1 with mixed.
To Try from spot (a whole number) with picked (a whole number). The overlap is bitwise and of picked and item spot of masks. If overlap is 0, Take from spot with picked.
To Gather from spot (a whole number) with picked (a whole number). If spot is more than the last position of words, Finish with picked, return. Gather from spot plus 1 with picked. If item spot of usable is 1, Try from spot with picked.
For every spot from 0 to 2.
Set item spot of masks to 0. Set item spot of usable to 1. The word is item spot of words.
For every index from 0 to the last position of word.
Set letter to character index of word. Locate from 0. The bit is shift 1 left by found. The overlap is bitwise and of item spot of masks and bit. If overlap is more than 0, set item spot of usable to 0, stop. Increase item spot of masks by bit.
Gather from 0 with 0. Show best.
Expected stdout
4