Friday, January 19, 2018

DP :Rat maze, Minimum cost path





Robot walked from the upper left to the lower right, can only go down and to the right, the number of each grid is height,
If the next cell height is higher than the current, we must pay the difference cost, otherwise no cost,
Find the minimum cost to reach the lower right corner,
Follow up 1, print the minimum cost path;

 November 25, 2017 in United States |
Facebook SDE1



Problem 2

-->
Given a non-empty string s, you may delete at most k characters. Judge whether you can make it a palindrome.



Remove a character from a string to make it a palindrome



Given a string, we need to check whether it is possible to make this string a palindrome after removing exactly one character from this.
Examples:
Input  : str = “abcba”
Output : Yes
we can remove character ‘c’ to make string palindrome

Input  : str = “abcbea”
Output : Yes
we can remove character ‘e’ to make string palindrome

Input : str = “abecbea”
It is not possible to make this string palindrome 
just by removing one character 






-->

No comments:

Post a Comment