Posts

Showing posts from January 21, 2016

Dynamic Programming Example

Image
Dynamic programming problem explained and solved using C++. I like programming in general, but the paradigm which appeals to me most is Dynamic programming. Back in 2013, during my college days, I used to  hone my skills by solving problems on CodeChef. But then I got a job and it does not involve a lot of DP. Recently I've realized that I have become clumsy, and too used to the "safe life", hence I've decided to solve DP problems on HackerEarth, the purpose of this blog is to keep me motivated :p Samu and Shopping Samu is in super market and in a mood to do a lot of shopping. She needs to buy shirts, pants and shoes for herself and her family. There are N different shops. Each shop contains all these three items but at different prices. Now Samu has a strategy that she won't buy the same item from the current shop if she had already bought that item from the shop adjacent to the current shop. Now Samu is confused, because although she want to foll