Day 31 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to remove all vowels from a given string. The goal was to practice string traversal and filtering characters based on conditions. What the program does: • Takes a string as input • Checks each character in the string • Removes vowels (a, e, i, o, u) in both lowercase and uppercase • Builds a new string without vowels • Returns the final filtered string How the logic works: 1)A string vowels is defined containing all vowel characters 2)An empty string result_string is created to store the result 3)The program loops through each character in the input string 4)If the character is not a vowel, it is added to result_string 5)The process continues until all characters are checked 6)Finally, the filtered string is returned Example: Input: "Hello World" Output:"Hll Wrld" Another example: Input: "AEIOUaeiou" Output: "" (All characters are vowels) Why this approach works well: – Simple and easy to understand logic – Efficient single-pass traversal – Time Complexity: O(n) Key learnings from Day 31: – Iterating through strings – Filtering characters based on conditions – Working with string concatenation – Strengthening string manipulation fundamentals #100DaysOfCode #Day31 #Python #PythonProgramming #StringManipulation #ProblemSolving #CodingPractice #Algorithms #LearnByDoing #ComputerScience #ProgrammingJourney #DeveloperGrowth #BTech #CSE #AIandML #VITBhopal #TechJourney
Python Vowel Removal Program
More Relevant Posts
-
🔍 Day 36 of My Problem Solving Journey Today I explored one of the most important concepts in strings — Searching & Finding. In Python, we often use methods like: ✔️ find() → to get the index of a substring ✔️ in → to check existence ✔️ index() → similar to find but throws error if not found But instead of just using built-in functions, I tried to understand the internal logic behind searching 👇 Find the position of a substring without using built-in functions. 🧠 My Approach: Traverse the string Compare characters one by one Return index if match is found Return -1 if not found def my_find(s, sub): for i in r print(my_find("manuuuu", "u")) # Output: 3 ✨ What I learned: How searching works internally Difference between find() and index() Importance of logic building instead of relying on built-ins 📈 Small steps every day = Big growth over time! #Day36 #Python #CodingJourney #ProblemSolving #100DaysOfCode #Learning #Developers #Programming Rudra Sravan kumar
To view or add a comment, sign in
-
-
🚀 Day 52 of My Python & DSA Journey Today I revisited Complement of Base 10 Integer on LeetCode — but this time with a more optimized bit manipulation approach! 🔍 Problem Overview: Find the complement of a number by flipping all bits in its binary form. 🧠 Optimized Approach: Instead of converting to binary string, I used bitwise operations: • Create a mask with all bits set to 1 (same length as the number) • Use XOR (^) to flip the bits directly • Special case: when n = 0, return 1 👉 Formula used: (mask - 1) ^ n ⚡ Why this is better: • Avoids string conversion • Works directly on bits (more efficient) • Cleaner and more optimal solution 📊 Complexity: • Time Complexity: O(log n) • Space Complexity: O(1) 💡 Key Learnings: • Deepened understanding of bitwise operators • Learned how to build bit masks dynamically • Understood difference between basic vs optimized solutions Under the Guidance of : Rudra Sravan kumar and Manoj Kumar Reddy Parlapalli #Day52 #Python #LeetCode #BitManipulation #DataStructures #Algorithms #CodingJourney #100DaysOfCode 🚀
To view or add a comment, sign in
-
-
Day 2 of my LeetCode journey 🚀 Today’s problem: Group Anagrams This challenge was all about grouping strings that share the same characters. I approached it using a dictionary + hashing strategy in Python. For each word, I sorted its characters and used that as a key (converted into a tuple), ensuring all anagrams map to the same bucket. Here’s the core logic I implemented: ▪️Traverse the list of strings ▪️Sort each string → convert to tuple → use as dictionary key ▪️Append original string to the corresponding group ▪️Finally, return all grouped values This approach keeps the implementation clean and scalable. Time Complexity: ▪️Sorting each string takes O(k log k) (where k = length of string) ▪️For n strings → O(n * k log k) overall Space Complexity: ▪️O(n * k) for storing grouped anagrams A solid step forward in understanding how hashing + transformations can simplify complex grouping problems. Staying consistent and leveling up daily 💪 #LeetCode #Day2 #Python #DSA #CodingJourney #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 16 Task – Python Mini Challenge Today’s task was a simple yet powerful exercise to strengthen my looping and conditional logic skills. 🔹 Task: Given a list of numbers, calculate the sum of even and odd numbers separately. 🔹 What I implemented: ✔️ Method 1: Stored even & odd numbers in separate lists and used sum() ✔️ Method 2: Calculated sums directly using variables (more optimized approach) 🔹 Key takeaway: There’s always more than one way to solve a problem. Writing multiple approaches helps in understanding efficiency and clean coding practices. 🔹 What I learned deeply: Using loops effectively Applying conditional logic (if-else) Writing optimized solutions instead of relying only on extra space github link : https://lnkd.in/g4iZcnGt 📌 Completed the task and tested it with different inputs successfully. Building consistency, one problem at a time 💪🚀 #Python #100DaysOfCode #Coding #ProblemSolving #DeveloperJourney #LearnInPublic Codegnan BhanuTeja Garikapati
To view or add a comment, sign in
-
-
Ever tried to "fix" a value inside a `for` loop while zipping, only to find the original list unchanged? 🤔 Let's break down why. This is a classic Python iterator deep dive. When you zip lists, you create an iterator yielding tuples. The loop variable is just a reference to the current tuple element, not a pointer back into the list. **Key Mechanics:** - `zip()` produces an immutable tuple for each iteration. - Reassigning the loop variable simply points that variable to a new object; it does not mutate the original list. - The loop variable is a local name within the loop's scope, separate from the list's indices. **Takeaway:** To modify the original list, you need to access it by index, or use a list comprehension/map. Direct assignment to the iteration variable only rebinds the name. Understanding this distinction between names, references, and mutability is crucial for mastering Python's data model. It’s not a bug—it’s a feature of clean, predictable iteration. #Python #ProgrammingLogic #MorningCode #SoftwareEngineering #TechDeepDive What’s a similar "aha!" moment you’ve had with iterators or variable scoping?
To view or add a comment, sign in
-
Day 15/100: My code finally talked back! 🎙️✨ For two weeks, I’ve been talking at my computer. Today, it started listening. I mastered the input() function! The Catch: Python is a bit of a literalist. If you tell it you’re 25, it thinks you’re the word "25," not the number. Without Type Casting (int()), your math becomes a mess. It's the difference between "25 + 1 = 26" and "25 + 1 = 251." 🤦♂️ The Code: Python name = input("Enter your name: ") age = int(input("Enter your age: ")) # Casting to int so Python doesn't get confused print(f"Hi {name}! {age} is a great age to master Python. 🚀") Moving from static scripts to interactive tools feels like a massive level-up. ⬆️ #100DaysOfCode #Python #InteractiveCode #CodingLife #LearnToCode
To view or add a comment, sign in
-
-
Day 43 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find the Longest Common Prefix (LCP) among a list of strings. This is a popular problem that helps strengthen string manipulation and comparison logic. What the program does: • Takes a list of strings as input • Finds the common starting characters shared by all strings • Returns the longest common prefix • Handles edge cases like empty lists and single strings How the logic works: • If the list is empty, return an empty string • Sort the list of strings • Compare only the first and last strings (they will have the maximum difference) • Iterate character by character • Add matching characters to the prefix • Stop when characters don’t match • Return the final prefix Example: Input: ["flower", "flow", "flight"] Output: "fl" Another example: Input: ["dog", "racecar", "car"] Output: "" (No common prefix) Another example: Input: ["apple", "apricot", "april"] Output: "ap" Why this approach works well: – Sorting reduces comparisons to just two strings – Efficient and easy to implement – Time Complexity: O(n log n + m) Key learnings from Day 43: – String comparison techniques – Using sorting to simplify problems – Handling edge cases effectively – Writing optimized and clean logic #100DaysOfCode #Day43 #Python #PythonProgramming #Strings #Algorithms #ProblemSolving #CodingPractice #DataStructures #InterviewPrep #LearnByDoing #DeveloperGrowth #ProgrammingJourney #ComputerScience #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
Day 34 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find all possible substrings of a given string. A substring is a continuous sequence of characters within a string. The goal was to generate every possible substring using nested loops. What the program does: • Takes a string as input • Uses nested loops to generate substrings • Extracts substrings using string slicing • Stores all substrings in a list • Returns the list of all substrings How the logic works: •A function find_all_substrings(s) is defined •An empty list substrings is created to store results •The first loop selects the starting index i •The second loop selects the ending index j •Each substring is extracted using slicing: s[i:j+1] •The substring is appended to the result list •Finally, all substrings are returned Example: Input: "abc" Output: ['a', 'ab', 'abc', 'b', 'bc', 'c'] Another example: Input: "hello" Output: ['h', 'he', 'hel', 'hell', 'hello', 'e', 'el', 'ell', 'ello', 'l', 'll', 'llo', 'l', 'lo', 'o'] Why this approach works well: – Uses nested loops to explore all start–end positions – Demonstrates string slicing clearly – Time Complexity: O(n²) Key learnings from Day 34: – Understanding substring generation – Using nested loops effectively – Applying string slicing in Python – Strengthening string algorithm concepts #100DaysOfCode #Day34 #Python #PythonProgramming #StringAlgorithms #ProblemSolving #CodingPractice #Algorithms #LearnByDoing #ComputerScience #ProgrammingJourney #DeveloperGrowth #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
-
🚀 Day 55 of My Python & DSA Journey Back at it again on LeetCode—and today’s problem was all about recognizing patterns in strings 🔍 Problem Solved: Group Anagrams Grouped words that are anagrams of each other by using a hashmap (dictionary) and a clever trick—sorting each string to create a unique key. 💡 Words with the same sorted form belong to the same group, making it efficient to cluster anagrams together. ⚡ Key Learnings: • Strengthened understanding of hashmaps (dictionaries) • Learned how to use sorting as a key technique • Improved skills in string manipulation • Practiced grouping and organizing data efficiently 📊 Complexity: Time Complexity: O(n × k log k) Where: • n = number of strings • k = length of each string For each string, we sort it to form a key. Sorting takes O(k log k), and we do this for all n strings. Total Time Complexity = O(n × k log k) Space Complexity: O(n × k) We store all input strings in a hashmap (grouped by sorted keys). Each string contributes up to k characters Total Space Complexity = O(n × k) Under the Guidance of : Rudra Sravan kumar and Manoj Kumar Reddy Parlapalli #Day55 #Python #LeetCode #DSA #Algorithms #CodingJourney #100DaysOfCode 10000 Coders🚀
To view or add a comment, sign in
-
-
Day 42 of my #100DaysOfCode challenge 🚀 Today I worked on a Python program to find the K-th largest element in an array. This is a common problem in coding interviews and helps build understanding of sorting and indexing. What the program does: • Takes an array and a value k as input • Sorts the array in descending order • Returns the k-th largest element • Handles duplicate values correctly How the logic works: • The array is sorted in descending order using sorted() • Since Python uses 0-based indexing,the k-th largest element is at index k-1 • The element at index k-1 is returned as the result Example: Input: Array: [3, 2, 1, 5, 6, 4] k = 2 Output: 5 (2nd largest element) Another example: Input: Array: [3, 2, 3, 1, 2, 4, 5, 5, 6] k = 4 Output: 4 Why this approach works: – Simple and easy to implement – Uses built-in sorting for reliability – Time Complexity: O(n log n) Key learnings from Day 42: – Understanding sorting in descending order – Working with indexing (k-1) – Solving common interview problems – Handling duplicates in arrays #100DaysOfCode #Day42 #Python #PythonProgramming #Arrays #Sorting #Algorithms #DataStructures #ProblemSolving #CodingPractice #InterviewPrep #LearnByDoing #ProgrammingJourney #DeveloperGrowth #BTech #CSE #AIandML #VITBhopal #TechJourney
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development