From a7b0b650c347966dd6f207bc0409215c7dab4cd7 Mon Sep 17 00:00:00 2001 From: Afroz Chakure Date: Wed, 22 Nov 2023 23:35:33 +0530 Subject: [PATCH] Fixing merge problem --- .../FindModeInBinarySearchTree.java | 0 .../Easy/PascalsTriangle/PascalsTriangle.java | 0 .../DeepestLeavesSum/DeepestLeavesSum.java | 0 .../GenerateParantheses.java | 0 .../GlobalAndLocalInversion.java | 0 .../GlobalAndLocalInversions.cpp | 0 .../Medium/{ => HouseRobber}/HouseRobber.cpp | 0 .../Medium/HouseRobber/HouseRobber.java | 0 .../KthLargestElementInAnArray.cpp | 0 .../KthLargestElementInAnArray.java | 0 .../MaximumRowsCoveredByColumns.cpp | 0 .../MinimumRemoveToMakeValidParantheses.java | 0 .../Medium/MonotonicArray/MonotonicArray.java | 0 .../NumbersWithSameConsecutiveDifferences.cpp | 0 .../PascalTriangleII/PascalTriangleII.java | 0 .../ScoreOfParentheses.java | 0 .../ShortestPathWithAlternatingColors.cpp | 0 .../ShortestUnsortedContinuousSubarray.java | 0 .../SubarrayProductLessThanK.java | 0 .../Medium/TaskSchedular/TaskSchedular.java | 0 .../Medium/HouseRobber/HouseRobber.cpp | 21 ------------------- 21 files changed, 21 deletions(-) rename {Leetcode => LeetCode}/Algorithms/Easy/FindModeInBinarySearchTree/FindModeInBinarySearchTree.java (100%) rename {Leetcode => LeetCode}/Algorithms/Easy/PascalsTriangle/PascalsTriangle.java (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/DeepestLeavesSum/DeepestLeavesSum.java (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/GenerateParantheses/GenerateParantheses.java (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/GlobalAndLocalInversion/GlobalAndLocalInversion.java (100%) rename LeetCode/Algorithms/Medium/{ => GlobalAndLocalInversion}/GlobalAndLocalInversions.cpp (100%) rename LeetCode/Algorithms/Medium/{ => HouseRobber}/HouseRobber.cpp (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/HouseRobber/HouseRobber.java (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.cpp (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.java (100%) rename LeetCode/Algorithms/Medium/{TaskSchedular => }/MaximumRowsCoveredByColumns.cpp (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/MinimumRemoveToMakeValidParantheses/MinimumRemoveToMakeValidParantheses.java (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/MonotonicArray/MonotonicArray.java (100%) rename LeetCode/Algorithms/Medium/{TaskSchedular => }/NumbersWithSameConsecutiveDifferences.cpp (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/PascalTriangleII/PascalTriangleII.java (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/ScoreOfParentheses/ScoreOfParentheses.java (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/ShortestPathWithAlternatingColors.cpp (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/ShortestUnsortedContinuousSubarray/ShortestUnsortedContinuousSubarray.java (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/SubarrayProductLessThanK/SubarrayProductLessThanK.java (100%) rename {Leetcode => LeetCode}/Algorithms/Medium/TaskSchedular/TaskSchedular.java (100%) delete mode 100644 Leetcode/Algorithms/Medium/HouseRobber/HouseRobber.cpp diff --git a/Leetcode/Algorithms/Easy/FindModeInBinarySearchTree/FindModeInBinarySearchTree.java b/LeetCode/Algorithms/Easy/FindModeInBinarySearchTree/FindModeInBinarySearchTree.java similarity index 100% rename from Leetcode/Algorithms/Easy/FindModeInBinarySearchTree/FindModeInBinarySearchTree.java rename to LeetCode/Algorithms/Easy/FindModeInBinarySearchTree/FindModeInBinarySearchTree.java diff --git a/Leetcode/Algorithms/Easy/PascalsTriangle/PascalsTriangle.java b/LeetCode/Algorithms/Easy/PascalsTriangle/PascalsTriangle.java similarity index 100% rename from Leetcode/Algorithms/Easy/PascalsTriangle/PascalsTriangle.java rename to LeetCode/Algorithms/Easy/PascalsTriangle/PascalsTriangle.java diff --git a/Leetcode/Algorithms/Medium/DeepestLeavesSum/DeepestLeavesSum.java b/LeetCode/Algorithms/Medium/DeepestLeavesSum/DeepestLeavesSum.java similarity index 100% rename from Leetcode/Algorithms/Medium/DeepestLeavesSum/DeepestLeavesSum.java rename to LeetCode/Algorithms/Medium/DeepestLeavesSum/DeepestLeavesSum.java diff --git a/Leetcode/Algorithms/Medium/GenerateParantheses/GenerateParantheses.java b/LeetCode/Algorithms/Medium/GenerateParantheses/GenerateParantheses.java similarity index 100% rename from Leetcode/Algorithms/Medium/GenerateParantheses/GenerateParantheses.java rename to LeetCode/Algorithms/Medium/GenerateParantheses/GenerateParantheses.java diff --git a/Leetcode/Algorithms/Medium/GlobalAndLocalInversion/GlobalAndLocalInversion.java b/LeetCode/Algorithms/Medium/GlobalAndLocalInversion/GlobalAndLocalInversion.java similarity index 100% rename from Leetcode/Algorithms/Medium/GlobalAndLocalInversion/GlobalAndLocalInversion.java rename to LeetCode/Algorithms/Medium/GlobalAndLocalInversion/GlobalAndLocalInversion.java diff --git a/LeetCode/Algorithms/Medium/GlobalAndLocalInversions.cpp b/LeetCode/Algorithms/Medium/GlobalAndLocalInversion/GlobalAndLocalInversions.cpp similarity index 100% rename from LeetCode/Algorithms/Medium/GlobalAndLocalInversions.cpp rename to LeetCode/Algorithms/Medium/GlobalAndLocalInversion/GlobalAndLocalInversions.cpp diff --git a/LeetCode/Algorithms/Medium/HouseRobber.cpp b/LeetCode/Algorithms/Medium/HouseRobber/HouseRobber.cpp similarity index 100% rename from LeetCode/Algorithms/Medium/HouseRobber.cpp rename to LeetCode/Algorithms/Medium/HouseRobber/HouseRobber.cpp diff --git a/Leetcode/Algorithms/Medium/HouseRobber/HouseRobber.java b/LeetCode/Algorithms/Medium/HouseRobber/HouseRobber.java similarity index 100% rename from Leetcode/Algorithms/Medium/HouseRobber/HouseRobber.java rename to LeetCode/Algorithms/Medium/HouseRobber/HouseRobber.java diff --git a/Leetcode/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.cpp b/LeetCode/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.cpp similarity index 100% rename from Leetcode/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.cpp rename to LeetCode/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.cpp diff --git a/Leetcode/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.java b/LeetCode/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.java similarity index 100% rename from Leetcode/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.java rename to LeetCode/Algorithms/Medium/KthLargestElementInAnArray/KthLargestElementInAnArray.java diff --git a/LeetCode/Algorithms/Medium/TaskSchedular/MaximumRowsCoveredByColumns.cpp b/LeetCode/Algorithms/Medium/MaximumRowsCoveredByColumns.cpp similarity index 100% rename from LeetCode/Algorithms/Medium/TaskSchedular/MaximumRowsCoveredByColumns.cpp rename to LeetCode/Algorithms/Medium/MaximumRowsCoveredByColumns.cpp diff --git a/Leetcode/Algorithms/Medium/MinimumRemoveToMakeValidParantheses/MinimumRemoveToMakeValidParantheses.java b/LeetCode/Algorithms/Medium/MinimumRemoveToMakeValidParantheses/MinimumRemoveToMakeValidParantheses.java similarity index 100% rename from Leetcode/Algorithms/Medium/MinimumRemoveToMakeValidParantheses/MinimumRemoveToMakeValidParantheses.java rename to LeetCode/Algorithms/Medium/MinimumRemoveToMakeValidParantheses/MinimumRemoveToMakeValidParantheses.java diff --git a/Leetcode/Algorithms/Medium/MonotonicArray/MonotonicArray.java b/LeetCode/Algorithms/Medium/MonotonicArray/MonotonicArray.java similarity index 100% rename from Leetcode/Algorithms/Medium/MonotonicArray/MonotonicArray.java rename to LeetCode/Algorithms/Medium/MonotonicArray/MonotonicArray.java diff --git a/LeetCode/Algorithms/Medium/TaskSchedular/NumbersWithSameConsecutiveDifferences.cpp b/LeetCode/Algorithms/Medium/NumbersWithSameConsecutiveDifferences.cpp similarity index 100% rename from LeetCode/Algorithms/Medium/TaskSchedular/NumbersWithSameConsecutiveDifferences.cpp rename to LeetCode/Algorithms/Medium/NumbersWithSameConsecutiveDifferences.cpp diff --git a/Leetcode/Algorithms/Medium/PascalTriangleII/PascalTriangleII.java b/LeetCode/Algorithms/Medium/PascalTriangleII/PascalTriangleII.java similarity index 100% rename from Leetcode/Algorithms/Medium/PascalTriangleII/PascalTriangleII.java rename to LeetCode/Algorithms/Medium/PascalTriangleII/PascalTriangleII.java diff --git a/Leetcode/Algorithms/Medium/ScoreOfParentheses/ScoreOfParentheses.java b/LeetCode/Algorithms/Medium/ScoreOfParentheses/ScoreOfParentheses.java similarity index 100% rename from Leetcode/Algorithms/Medium/ScoreOfParentheses/ScoreOfParentheses.java rename to LeetCode/Algorithms/Medium/ScoreOfParentheses/ScoreOfParentheses.java diff --git a/Leetcode/Algorithms/Medium/ShortestPathWithAlternatingColors.cpp b/LeetCode/Algorithms/Medium/ShortestPathWithAlternatingColors.cpp similarity index 100% rename from Leetcode/Algorithms/Medium/ShortestPathWithAlternatingColors.cpp rename to LeetCode/Algorithms/Medium/ShortestPathWithAlternatingColors.cpp diff --git a/Leetcode/Algorithms/Medium/ShortestUnsortedContinuousSubarray/ShortestUnsortedContinuousSubarray.java b/LeetCode/Algorithms/Medium/ShortestUnsortedContinuousSubarray/ShortestUnsortedContinuousSubarray.java similarity index 100% rename from Leetcode/Algorithms/Medium/ShortestUnsortedContinuousSubarray/ShortestUnsortedContinuousSubarray.java rename to LeetCode/Algorithms/Medium/ShortestUnsortedContinuousSubarray/ShortestUnsortedContinuousSubarray.java diff --git a/Leetcode/Algorithms/Medium/SubarrayProductLessThanK/SubarrayProductLessThanK.java b/LeetCode/Algorithms/Medium/SubarrayProductLessThanK/SubarrayProductLessThanK.java similarity index 100% rename from Leetcode/Algorithms/Medium/SubarrayProductLessThanK/SubarrayProductLessThanK.java rename to LeetCode/Algorithms/Medium/SubarrayProductLessThanK/SubarrayProductLessThanK.java diff --git a/Leetcode/Algorithms/Medium/TaskSchedular/TaskSchedular.java b/LeetCode/Algorithms/Medium/TaskSchedular/TaskSchedular.java similarity index 100% rename from Leetcode/Algorithms/Medium/TaskSchedular/TaskSchedular.java rename to LeetCode/Algorithms/Medium/TaskSchedular/TaskSchedular.java diff --git a/Leetcode/Algorithms/Medium/HouseRobber/HouseRobber.cpp b/Leetcode/Algorithms/Medium/HouseRobber/HouseRobber.cpp deleted file mode 100644 index 29812d0..0000000 --- a/Leetcode/Algorithms/Medium/HouseRobber/HouseRobber.cpp +++ /dev/null @@ -1,21 +0,0 @@ -class Solution { -public: - int rob(vector& nums) { - int rob1 = 0, rob2 = 0; - - // [1, 2, 3, 1] - // [rob1, rob2, n, n+1....] - - for(int &element: nums) - { - int temp = max(rob1 + element, rob2); - rob1 = rob2; - rob2 = temp; - } - - return rob2; - } -}; - -// Time Complexity - O(N) -// Space Complexity - O(1), Dynamic programming