From 824a38a7cb8fdbb203467a40b3b107059329a4d9 Mon Sep 17 00:00:00 2001 From: LibinT Date: Tue, 18 Mar 2025 06:34:31 +0530 Subject: [PATCH 1/5] .\README.md --- README.md | 143 +----------------------------------------------------- 1 file changed, 2 insertions(+), 141 deletions(-) diff --git a/README.md b/README.md index d922b9d..781dec2 100644 --- a/README.md +++ b/README.md @@ -1,148 +1,9 @@ -# GitHub Guide for Submitting Challenge Solutions - -Welcome to the GitHub repository for coding challenges! This guide will walk you through the process of creating a branch under your name and uploading your solution files step by step. If you are new to Git and GitHub, follow these instructions carefully. - ---- - -## πŸš€ Setting Up Git and GitHub - -### 1️⃣ Install Git -If you haven't installed Git yet, download and install it from [Git's official website](https://git-scm.com/downloads). - -### 2️⃣ Create a GitHub Account -If you don’t have a GitHub account, create one at [GitHub](https://github.com/). - -### 3️⃣ Fork the Repository -1. Go to the repository URL shared by your instructor. -2. Click on the **Fork** button in the top-right corner to create a copy in your GitHub account. - -### 4️⃣ Clone the Repository Locally -1. Open **Terminal** (Linux/macOS) or **Command Prompt/Powershell** (Windows). -2. Run the following command, replacing `your-username` with your GitHub username: - - ```sh - git clone https://github.com/WeCode-Community-Dev/blind-75-challenge.git - ``` - -3. Navigate into the repository folder: - - ```sh - cd blind-75-challenge - ``` +# Libin's Blind 75 Challenge --- -## 🌿 Creating a Branch Under Your Name -Each student must create a separate branch with their name before making any changes. - -1. Check the current branches: - - ```sh - git branch - ``` - -2. Create a new branch with your name (make sure this is unique - add some unique number or characters to make sure it is not already there): - - ```sh - git checkout -b your-branch-name - ``` - -3. Verify the branch was created and switched to it: - - ```sh - git branch - ``` - - Your name should now be highlighted, meaning you are on that branch. - ---- - -## πŸ” Setting Upstream and Pulling Latest Changes -Before working on a new challenge, ensure your repository is up to date. - -1. Add the original repository as the upstream remote (only required once): - - ```sh - git remote add upstream https://github.com/WeCode-Community-Dev/blind-75-challenge.git - ``` - -2. Fetch the latest changes: - - ```sh - git fetch upstream - ``` - -3. Merge the latest changes into your branch: - - ```sh - git merge upstream/main - ``` +Challenge #1 - --- -## ✏️ Adding Your Challenge Solution -Upload only the solution file for each challenge (e.g., `solution.py`, `solution.cpp`, `solution.java`). -you can name the file .py or .cpp or .java etc. -example: two-sum.py or two-sum.cpp or two-sum.java as per the programming language you choose - -1. Navigate to the folder for the challenge you are working on. -2. Place your solution file inside the appropriate challenge folder. - -Example structure: - -``` -repository-name/ -β”‚-- Challenge-1/ -β”‚ β”‚-- solution.py # Your file -β”‚-- Challenge-2/ -β”‚ β”‚-- solution.cpp # Another file -``` - ---- - -## πŸ“€ Committing and Pushing Your Code - -Replace the "challenge-1" with problem name - -1. Add the file you modified: - - ```sh - git add Challenge-1/solution.py - ``` - -2. Commit your changes with a meaningful message: - - ```sh - git commit -m "Added solution for Challenge 1" - ``` - -3. Push your branch to your GitHub repository: - - ```sh - git push origin your-branch-name - ``` - ---- - -## πŸ”„ Creating a Pull Request (Not Required) -Once you've pushed your changes, you need to create a **Pull Request (PR)**. - -1. Go to your GitHub repository. -2. Switch to your branch (`your-branch-name`). -3. Click on **Compare & pull request**. -4. Add a meaningful **title** and **description**. -5. Click **Create pull request**. - -Your code will now be reviewed and merged by the instructor! πŸŽ‰ - ---- - -## ❗ Important Rules -βœ… Always create a branch under your name. -βœ… Upload only the solution file (no unnecessary files or folders). -βœ… Keep your repository updated by pulling the latest changes. -βœ… Use meaningful commit messages. -βœ… Create a pull request for every challenge. - Happy coding! πŸš€ - From 1c2898a3bfe039dde4c2655ba6ba833669f208ec Mon Sep 17 00:00:00 2001 From: LibinT Date: Tue, 18 Mar 2025 06:42:23 +0530 Subject: [PATCH 2/5] .\README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 781dec2..40db3ea 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Libin's Blind 75 Challenge +# We Code Blind 75 Challenge --- -Challenge #1 - - ---- +## About +# Name: Libin T +# Email: libinthankayathil@gmail.com Happy coding! πŸš€ From 25badcfd66d266466f42c8bab156c0424ff5a2fc Mon Sep 17 00:00:00 2001 From: LibinT Date: Sun, 23 Mar 2025 00:28:55 +0530 Subject: [PATCH 3/5] Added solution for Two Sum --- two-sum/two-sum.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 two-sum/two-sum.py diff --git a/two-sum/two-sum.py b/two-sum/two-sum.py new file mode 100644 index 0000000..1ff27e1 --- /dev/null +++ b/two-sum/two-sum.py @@ -0,0 +1,6 @@ +class Solution: + def twoSum(self, nums: List[int], target: int) -> List[int]: + for i in range(len(nums)): + for j in range(len(nums)): + if nums[j] == target - nums[i] and i != j: + return [i, j] From 0caffdd32ce79a368a2df6fb86adee60cca1e581 Mon Sep 17 00:00:00 2001 From: LibinT Date: Sun, 23 Mar 2025 00:38:31 +0530 Subject: [PATCH 4/5] Added solution for best time to sell and buy stock --- best-time-to-buy-and-sell-stocks/solution.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 best-time-to-buy-and-sell-stocks/solution.py diff --git a/best-time-to-buy-and-sell-stocks/solution.py b/best-time-to-buy-and-sell-stocks/solution.py new file mode 100644 index 0000000..12b3d01 --- /dev/null +++ b/best-time-to-buy-and-sell-stocks/solution.py @@ -0,0 +1,14 @@ +class Solution: + def maxProfit(self, prices: List[int]) -> int: + # Two-Pointer + left, right = 0, 1 + profit = 0 + + while right < len(prices): + if prices[right] > prices[left]: + profit = max(profit, prices[right] - prices[left]) + else: + left = right + + right += 1 + return profit From 5a0ea1220c1b14fe1e8831937db6817ce2fce7fc Mon Sep 17 00:00:00 2001 From: LibinT Date: Sun, 23 Mar 2025 00:51:14 +0530 Subject: [PATCH 5/5] Added solution for Contains Duplicate --- Contains-Duplicate/solution.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Contains-Duplicate/solution.py diff --git a/Contains-Duplicate/solution.py b/Contains-Duplicate/solution.py new file mode 100644 index 0000000..a03f3a2 --- /dev/null +++ b/Contains-Duplicate/solution.py @@ -0,0 +1,11 @@ +class Solution: + def containsDuplicate(self, nums: List[int]) -> bool: + + hash_set = set() + + for num in nums: + if num in hash_set: + return True + else: + hash_set.add(num) + return False \ No newline at end of file