From d8c3f984e4c4ad1bfcf5bb1538faa0e29cf0b9fc Mon Sep 17 00:00:00 2001 From: Amir Ariffin Date: Tue, 17 Oct 2017 18:51:23 +0800 Subject: [PATCH] Fix grammar issues in DP (#53) * ran content through grammar checker and break the code example after column 100 to remove horizontal scroll bar when viewing on GitHub * Update dynamic-programming.md --- algorithms/dynamic-programming.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/algorithms/dynamic-programming.md b/algorithms/dynamic-programming.md index be6979d6..978fa611 100644 --- a/algorithms/dynamic-programming.md +++ b/algorithms/dynamic-programming.md @@ -5,8 +5,8 @@ Dynamic Programming - Given some coin denominations and a target value `M`, return the coins combination with the minimum number of coins. - Time complexity: `O(MN)`, where N is the number of distinct type of coins. - Space complexity: `O(M)`. -- Given a set of numbers in an array which represent number of consecutive days of AirBnb reservation requested, as a host, pick the sequence which maximizes the number of days of occupancy, at the same time, leaving at least a 1 day gap in-between bookings for cleaning. - - Problem reduces to finding the maximum sum of non-consecutive array elements. +- Given a set of numbers in an array which represent a number of consecutive days of Airbnb reservation requested, as a host, pick the sequence which maximizes the number of days of occupancy, at the same time, leaving at least a 1-day gap in-between bookings for cleaning. + - The problem reduces to finding the maximum sum of non-consecutive array elements. - E.g. ~~~ // [5, 1, 1, 5] => 10 @@ -16,7 +16,8 @@ Dynamic Programming // Dec 6 - 7 // Dec 7 - 12 - The answer would be to pick Dec 1-5 (5 days) and then pick Dec 7-12 for a total of 10 days of occupancy, at the same time, leaving at least 1 day gap for cleaning between reservations. + The answer would be to pick Dec 1-5 (5 days) and then pick Dec 7-12 for a total of 10 days of + occupancy, at the same time, leaving at least 1-day gap for cleaning between reservations. Similarly, // [3, 6, 4] => 7