Can someone tell me where we use Dynamic/Greedy algorithm and how we trace from the question that it will solved by any one of the above?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.Sign up to join this community
An algorithm that always takes the best immediate, or local, solution while finding an answer. Greedy algorithms find the overall, or globally, optimal solution for some optimization problems, but may find less-than-optimal solutions for some instances of other problems. .
Problems that can be solved by a Greedy Algorithm will have two properties:
Essentially, Greedy Algorithms solve combinatorial problems having the properties of matroid.
For more detail you can consult Introduction to Algorithm.
Solve an optimization problem by caching subproblem solutions (memoization) rather than recomputing them. 
Dynamic Programming algorithms are often used for optimization because it will examine the previously solved subproblems and will combine their solutions to give the best solution for the given problem.
Now, problems that can be solved by a Dynamic Programming Algorithm will have this necessary condition:
Principle of Optimality: An optimal policy has the property that whatever the initial state and initial decision are, the remaining decisions must constitute an optimal policy with regard to the state resulting from the first decision.