diff --git a/2024/01-2024(jan)/22 - Paths from root with a specified sum.md b/2024/01-2024(jan)/22 - Paths from root with a specified sum.md index f578a7c..edd6816 100644 --- a/2024/01-2024(jan)/22 - Paths from root with a specified sum.md +++ b/2024/01-2024(jan)/22 - Paths from root with a specified sum.md @@ -1,6 +1,8 @@ ## 22. Paths from root with a specified sum The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/paths-from-root-with-a-specified-sum/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach - I used a recursive approach to traverse the tree and find paths with the specified sum. - For each node, I added its value to the current sum and checked if it equals the target sum. @@ -39,4 +41,4 @@ public: For discussions, questions, or doubts related to this solution, please visit our [discussion section](https://github.com/getlost01/gfg-potd/discussions). We welcome your input and aim to foster a collaborative learning environment. -If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. \ No newline at end of file +If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. diff --git a/2024/01-2024(jan)/23 - Course Schedule.md b/2024/01-2024(jan)/23 - Course Schedule.md index 5c5eef6..f2a4b59 100644 --- a/2024/01-2024(jan)/23 - Course Schedule.md +++ b/2024/01-2024(jan)/23 - Course Schedule.md @@ -1,6 +1,8 @@ ## 23. Course Schedule The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/course-schedule/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach I am using a topological sorting approach to find the order of courses. The idea is to first create a directed graph representing the prerequisite relationships between courses. Then, I calculate the in-degree (number of incoming edges) for each course. Starting with the courses that have no prerequisites (in-degre e = 0), I use a queue to perform a topological sort. @@ -66,4 +68,4 @@ public: For discussions, questions, or doubts related to this solution, please visit our [discussion section](https://github.com/getlost01/gfg-potd/discussions). We welcome your input and aim to foster a collaborative learning environment. If you find this solution helpful, consider supporting us by giving a ⭐ star to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. -``` \ No newline at end of file +``` diff --git a/2024/01-2024(jan)/24 - Is it a tree.md b/2024/01-2024(jan)/24 - Is it a tree.md index 442b7bd..bd9f273 100644 --- a/2024/01-2024(jan)/24 - Is it a tree.md +++ b/2024/01-2024(jan)/24 - Is it a tree.md @@ -1,6 +1,8 @@ ## 24. Is it a tree ? The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/is-it-a-tree/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach - Check if the difference between the number of nodes (n) and edges (m) is exactly 1. If not, it's not a tree. - Initialize a vector `vis` to keep track of visited nodes. @@ -52,4 +54,4 @@ public: For discussions, questions, or doubts related to this solution, please visit our [discussion section](https://github.com/getlost01/gfg-potd/discussions). We welcome your input and aim to foster a collaborative learning environment. -If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. \ No newline at end of file +If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. diff --git a/2024/01-2024(jan)/25 - Shortest Prime Path.md b/2024/01-2024(jan)/25 - Shortest Prime Path.md index e224141..1651be3 100644 --- a/2024/01-2024(jan)/25 - Shortest Prime Path.md +++ b/2024/01-2024(jan)/25 - Shortest Prime Path.md @@ -2,6 +2,8 @@ The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/shortest-prime-path--141631/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach - Create a sieve of Eratosthenes to efficiently check for prime numbers. @@ -78,4 +80,4 @@ public: For discussions, questions, or doubts related to this solution, please visit our [discussion section](https://github.com/getlost01/gfg-potd/discussions). We welcome your input and aim to foster a collaborative learning environment. If you find this solution helpful, consider supporting us by giving a ⭐ star to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. -``` \ No newline at end of file +``` diff --git a/2024/01-2024(jan)/26 - Fractional Knapsack.md b/2024/01-2024(jan)/26 - Fractional Knapsack.md index cd519ee..9ba8189 100644 --- a/2024/01-2024(jan)/26 - Fractional Knapsack.md +++ b/2024/01-2024(jan)/26 - Fractional Knapsack.md @@ -1,6 +1,8 @@ ## 26. Fractional Knapsack The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/fractional-knapsack-1587115620/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach - I implemented a greedy strategy to maximize the value per weight. - I sorted the items in descending order based on their value-to-weight ratios. @@ -44,4 +46,4 @@ public: For discussions, questions, or doubts related to this solution, please visit our [discussion section](https://github.com/getlost01/gfg-potd/discussions). We welcome your input and aim to foster a collaborative learning environment. -If you find this solution helpful, consider supporting us by giving a ⭐ star to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. \ No newline at end of file +If you find this solution helpful, consider supporting us by giving a ⭐ star to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. diff --git a/2024/01-2024(jan)/27 - Brackets in Matrix Chain Multiplication.md b/2024/01-2024(jan)/27 - Brackets in Matrix Chain Multiplication.md index ec8f9ad..367352b 100644 --- a/2024/01-2024(jan)/27 - Brackets in Matrix Chain Multiplication.md +++ b/2024/01-2024(jan)/27 - Brackets in Matrix Chain Multiplication.md @@ -1,6 +1,8 @@ ## 27. Brackets in Matrix Chain Multiplication The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/brackets-in-matrix-chain-multiplication1024/1) +![](https://badgen.net/badge/Level/Hard/red) + ### My Approach I implemented the matrix chain multiplication using dynamic programming with bottom-up tabulation. The steps are as follows: @@ -52,4 +54,4 @@ public: For discussions, questions, or doubts related to this solution, please visit our [discussion section](https://github.com/getlost01/gfg-potd/discussions). We welcome your input and aim to foster a collaborative learning environment. -If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. \ No newline at end of file +If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. diff --git a/2024/01-2024(jan)/29 - Count digit groupings of a number.md b/2024/01-2024(jan)/29 - Count digit groupings of a number.md index c209175..2bf9c34 100644 --- a/2024/01-2024(jan)/29 - Count digit groupings of a number.md +++ b/2024/01-2024(jan)/29 - Count digit groupings of a number.md @@ -1,6 +1,8 @@ ## 29. Count digit groupings of a number The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/count-digit-groupings-of-a-number1520/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach - I use a recursive approach where I start iterating through the string from left to right. - For each digit, I add it to the current sum, and if the sum becomes greater than or equal to the current target sum, I recursively call the function with the updated parameters. @@ -49,4 +51,4 @@ public: For discussions, questions, or doubts related to this solution, please visit our [discussion section](https://github.com/getlost01/gfg-potd/discussions). We welcome your input and aim to foster a collaborative learning environment. -If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. \ No newline at end of file +If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. diff --git a/2024/01-2024(jan)/30 - LCS of three strings.md b/2024/01-2024(jan)/30 - LCS of three strings.md index 924b372..9dbc47f 100644 --- a/2024/01-2024(jan)/30 - LCS of three strings.md +++ b/2024/01-2024(jan)/30 - LCS of three strings.md @@ -1,6 +1,8 @@ ## 30. LCS of three strings The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/lcs-of-three-strings0028/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach I have used dynamic programming to solve this problem. I created a 3D array `dp` to store the length of the Longest Common Subsequence (LCS) of substrings of A, B, and C. The recurrence relation is based on comparing characters at each position. If the characters are equal, I update the length based on the LCS of the substrings without these characters. The final answer is stored in `dp[n1][n2][n3]`, representing the LCS of the entire strings A, B, and C. @@ -34,4 +36,4 @@ public: For discussions, questions, or doubts related to this solution, please visit our [discussion section](https://github.com/getlost01/gfg-potd/discussions). We welcome your input and aim to foster a collaborative learning environment. -If you find this solution helpful, consider supporting us by giving a ⭐ star to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. \ No newline at end of file +If you find this solution helpful, consider supporting us by giving a ⭐ star to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. diff --git a/2024/01-2024(jan)/31 - Insert and Search in a Trie.md b/2024/01-2024(jan)/31 - Insert and Search in a Trie.md index 25fb601..197f364 100644 --- a/2024/01-2024(jan)/31 - Insert and Search in a Trie.md +++ b/2024/01-2024(jan)/31 - Insert and Search in a Trie.md @@ -1,6 +1,8 @@ ## 31. Insert and Search in a Trie The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/lcs-of-three-strings0028/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach - For both `insert` and `search` functions, I'm using recursion to traverse the trie based on the characters of the input key. - In the `insert` function, if a character node is not present in the current TrieNode, I create a new node for that character and continue the insertion. @@ -45,4 +47,4 @@ public: For discussions, questions, or doubts related to this solution, please visit our [discussion section](https://github.com/getlost01/gfg-potd/discussions). We welcome your input and aim to foster a collaborative learning environment. -If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. \ No newline at end of file +If you find this solution helpful, consider supporting us by giving a `⭐ star` to the [getlost01/gfg-potd](https://github.com/getlost01/gfg-potd) repository. diff --git a/2024/02-2024(feb)/02 - Implement Atoi.md b/2024/02-2024(feb)/02 - Implement Atoi.md index 2e75518..dab75d3 100644 --- a/2024/02-2024(feb)/02 - Implement Atoi.md +++ b/2024/02-2024(feb)/02 - Implement Atoi.md @@ -1,6 +1,8 @@ ## 02. Implement Atoi The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/implement-atoi/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach I have implemented the Atoi function using a simple iteration through the input string. Here's a breakdown of the steps: diff --git a/2024/02-2024(feb)/readme.md b/2024/02-2024(feb)/readme.md new file mode 100644 index 0000000..41e3d29 --- /dev/null +++ b/2024/02-2024(feb)/readme.md @@ -0,0 +1,7 @@ +## February - 2024 + +Welcome! to the directory that have the solutions for the GeeksforGeeks (GFG) Problem of the Day for the month of **February 2024**. + +Feel free to navigate through the directory and examine the solutions for each problem. Remember that understanding the logic behind each solution is crucial for your growth as a programmer. + +To access the original problem statements, please visit the **GFG [Problem of the Day](https://practice.geeksforgeeks.org/problem-of-the-day)** page. diff --git a/README.md b/README.md index 75ea666..c3fe543 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ ### Que - Implement Atoi The problem can be found at the following link: [Question Link](https://www.geeksforgeeks.org/problems/implement-atoi/1) +![](https://badgen.net/badge/Level/Medium/yellow) + ### My Approach I have implemented the Atoi function using a simple iteration through the input string. Here's a breakdown of the steps: