From d992f8d2ec20c5011d6871626d1619c0890dff04 Mon Sep 17 00:00:00 2001 From: Atharv Joshi Date: Fri, 16 Jan 2026 14:42:29 -0500 Subject: [PATCH] Completed DP-1 House Robber and Coin Chnage --- Problem1.java | 34 ++++++++++++++++++++++++++++++++++ Problem2.java | 26 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 Problem1.java create mode 100644 Problem2.java diff --git a/Problem1.java b/Problem1.java new file mode 100644 index 00000000..2c21861d --- /dev/null +++ b/Problem1.java @@ -0,0 +1,34 @@ +// Time Complexity : O(MXN) M is the total number of coins and N is the lenght of Array +// Space Complexity : O(N) +// Did this code successfully run on Leetcode : Yes +// Any problem you faced while coding this :Initialise the Array with Max Value when looking for the Minimum + + +// Your code here along with comments explaining your approach +class Solution{ + int coinChange(int coins[], int amount){ + //Edge Case + if(amount<1){ + return 0; + } + else{ + // Make an array starting from 0 to the Max amount in the array so that at each position we check the mimum coints to reach that particular value + int minCoinsDP[]=new int[amount+1]; + for(int i=1; i