Tag: Dynamic Programming
-
Data Structures & Algorithms in Java – Dynamic Programming – House Robber
Problem: A robber goes to rob in a series of houses built next to each other. He can’t rob from two consecutive houses , this will trigger an alarm. How much maximum money can he steal ? Input: The array [1,2,3,1] represents money in each house starting from the first index. Output: Maximum amount the…
-
Datastructures & Algorithms in Java – Dynamic Programming – Word Break
Problem: Given a word , find if the word could be formed by joining words together from a given dictionary. Example: The word “datastructure” can be formed using the words from the dictionary: [“data”,”algorithms”,”structure”] So ,the output is true. For the word “breadandbiscuit” and the dictionary [“and”,”bis”,”bread”] the output is false Assumptions: The words and…