ben.wxc
BAN USERhere is the idea:
(1) allocate an array of vector<string> size equal of length of the input array.
(2) initialize this array by pushing sub-string(inputstring, 0 , i)
(3) for each item from the array, domerge from the last char to the first char(merge reversely)and push newly generated string to the vector. try combining the tail char with all strings in its previous array element (i-1)
(4) loop (3) for all array elements
(5) the length of the shortest string in the last array element will be the answer.
here is the idea:
(1) allocate an array of vector<string> size equal of length of the input array.
(2) initialize this array by pushing sub-string(inputstring, 0 , i)
(3) for each item from the array, domerge from the last char to the first char(merge reversely)and push newly generated string to the vector. try combining the tail char with all strings in its previous array element (i-1)
(4) loop (3) for all array elements
(5) the length of the shortest string in the last array element will be the answer.
here is the idea:
- ben.wxc February 20, 2012(1) allocate an array of vector<string> size equal of length of the input array.
(2) initialize this array by pushing sub-string(inputstring, 0 , i)
(3) for each item from the array, domerge from the last char to the first char(merge reversely)and push newly generated string to the vector. try combining the tail char with all strings in its previous array element (i-1)
(4) loop (3) for all array elements
(5) the length of the shortest string in the last array element will be the answer.