Monday, August 18, 2014

COJ 1028. All in All

At first , this task smells like dynamic programming but it is much easier than that. The thing is only checking if the first string can be obtained by removing some elements form the second one. If it is possible, then all the letters of the first string must exist on the second string on the same order as the exist on the first string. The only thing we need to do is too loop once over the second string and by starting from the first letter of the first string check and find every element in the exact order. If we reach the end of the loop but our checker didn't reach the final letter of the first string it means that the answer is "No" , otherwise it is "Yes". Check the source code for a better understanding


       FULL SOURCE CODE

No comments:

Post a Comment