From 43e78490f3a26d38370f1574dfee6fb6efca6d32 Mon Sep 17 00:00:00 2001 From: esachdev28 Date: Fri, 31 Oct 2025 19:14:01 +0530 Subject: [PATCH 1/2] add code --- .../complex_pattern | 62 ------------------- python/DynamicProgramming/Climbing_Stairs.py | 0 python/DynamicProgramming/UniquePaths.py | 0 .../ Question_Non_Overlapping_Intervals.py | 0 python/Greedy Algorithm/ Save_People.py | 0 python/Greedy Algorithm/CoinChange(Greedy).py | 0 6 files changed, 62 deletions(-) delete mode 100644 python/Dynamic Programming patterns/complex_pattern create mode 100644 python/DynamicProgramming/Climbing_Stairs.py create mode 100644 python/DynamicProgramming/UniquePaths.py create mode 100644 python/Greedy Algorithm/ Question_Non_Overlapping_Intervals.py create mode 100644 python/Greedy Algorithm/ Save_People.py create mode 100644 python/Greedy Algorithm/CoinChange(Greedy).py diff --git a/python/Dynamic Programming patterns/complex_pattern b/python/Dynamic Programming patterns/complex_pattern deleted file mode 100644 index 68a8e78a..00000000 --- a/python/Dynamic Programming patterns/complex_pattern +++ /dev/null @@ -1,62 +0,0 @@ -# Dynamic program pattern problem: - -# Example for n = 3 -# Output: -# * -# ** * -# ******** -# ** * -# * -# Example for n = 5 -# Output: -# * -# ** -# *** -# **** * -# ************ -# **** * -# *** -# ** -# * - -# Solution in Python -def pattern(n): - # Check if the number is odd and greater than or equal to 3 - if n % 2 == 0 or n < 3: - print("Please enter an odd number") - else: - # Calculate total columns in the widest part of the pattern - row_length = (n * 2) - 1 - # Calculate total columns in the middle solid line - col_length = (n * 2) + 2 - - # ----------------------------- - # Upper top part of the pattern - # ----------------------------- - # Print increasing stars for top-left side (first (n-2) lines) - for row in range(n - 2): - print("*" * (row + 1)) - - # Print the line having gap in between and star at both sides - for row in range(1): - print("*" * (n - 1) + " " * (n + 1) + "*") - - # Print the solid middle line (full stars) - for row in range(1): - print("*" * col_length) - - # Print the line below the solid one (same as above gap line) - for row in range(1): - print("*" * (n - 1) + " " * (n + 1) + "*") - - # ----------------------------- - # Lower bottom part of the pattern - # ----------------------------- - # Print decreasing stars for bottom-left side (mirror of top part) - for row in range(n - 2): - print("*" * (n - row - 2)) - - -# Take input from user -number = int(input("Enter the odd number : ")) -pattern(number) diff --git a/python/DynamicProgramming/Climbing_Stairs.py b/python/DynamicProgramming/Climbing_Stairs.py new file mode 100644 index 00000000..e69de29b diff --git a/python/DynamicProgramming/UniquePaths.py b/python/DynamicProgramming/UniquePaths.py new file mode 100644 index 00000000..e69de29b diff --git a/python/Greedy Algorithm/ Question_Non_Overlapping_Intervals.py b/python/Greedy Algorithm/ Question_Non_Overlapping_Intervals.py new file mode 100644 index 00000000..e69de29b diff --git a/python/Greedy Algorithm/ Save_People.py b/python/Greedy Algorithm/ Save_People.py new file mode 100644 index 00000000..e69de29b diff --git a/python/Greedy Algorithm/CoinChange(Greedy).py b/python/Greedy Algorithm/CoinChange(Greedy).py new file mode 100644 index 00000000..e69de29b From b0841b5497157e2844985426a00a5d1602ee5a28 Mon Sep 17 00:00:00 2001 From: esachdev28 Date: Fri, 31 Oct 2025 19:33:38 +0530 Subject: [PATCH 2/2] Updated NQueen.cpp solutioin C++ --- python/Dynamic Programming patterns/complex_pattern.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 python/Dynamic Programming patterns/complex_pattern.py diff --git a/python/Dynamic Programming patterns/complex_pattern.py b/python/Dynamic Programming patterns/complex_pattern.py new file mode 100644 index 00000000..e69de29b