🚀 Day 2 | Problem 2 of my 15-Day 50+ String DSA Challenge Problem: Count Vowels in a String (Java) Today I worked on a basic but important string problem and focused on getting the logic and flow right instead of just writing code. Key learnings: • Iterating through each character of a string • Correct use of loop boundaries to avoid runtime errors • Understanding array indexing (0 to length-1) • Applying conditional checks cleanly for vowel detection Strengthening fundamentals step by step 💪 #DSA #Java #StringProblems #LearningInPublic #CodingJourney
Counting Vowels in Java String Challenge
More Relevant Posts
-
🚀 Day 2 | Problem 1 of my 15-Day 50+ String DSA Challenge Problem: Find Length of a String (without using length()) Today I practised a basic but important string problem in Java and focused on understanding different looping approaches. Key learnings: • Calculated string length without using built-in methods • Understood the difference between `for` loop and `for-each` loop • Learned when index-based iteration is needed and when simple traversal is enough Strengthening fundamentals step by step 💪 #DSA #Java #StringProblems #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
Day 5 | Problem 1 – Score of a String Today I practised calculating the score of a string by finding the absolute difference between adjacent characters. Approach used: • Traverse the string from left to right • Calculate the absolute ASCII difference between consecutive characters • Add each difference to a running sum • Return the final score This problem helped me better understand character handling in strings, ASCII values, and loop-based traversal. #Java #DSA #StringProblems #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
🚀 Day 99 of #100DaysOfLeetCode 📌 Problem: 67. Add Binary 📊 Difficulty: Easy 💡 Key Insight: Binary addition follows the same rules as decimal addition — add digits from right to left while maintaining a carry. The only difference is everything is in base 2. 🛠️ Approach: Use two pointers starting from the end of both strings Add corresponding bits along with a carry Append the result bit (sum % 2) Update carry (sum / 2) Reverse the final string to get the answer ⏱️ Complexity: Time: O(n) Space: O(n) #LeetCode #Java #ProblemSolving #CodingChallenge #100DaysOfCode #DSA #LearningEveryday
To view or add a comment, sign in
-
-
Leetcode Problem | | Check If a String Contains All Binary Codes (1461) 🚀 Problem: Given a binary string s and integer k, check if all possible binary codes of length k exist in the string. Example: s = "00110", k = 2 Expected Output = true In substring and sliding window problems, boundary conditions matter more than logic sometimes. Consistent debugging > frustration. #DSA #Java #LeetCode #ProblemSolving #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 2 | Problem 3 of my 15-Day 50+ String DSA Challenge Problem: Swap Two Strings (Without Using a Third Variable) Today I learned how to swap two strings without using an extra variable. Since strings are immutable in Java, the solution uses concatenation and substring logic (with StringBuilder for efficiency). Key learnings: • Strings are immutable, so direct swapping isn’t possible • Concatenation + substring can be used to swap values • Understanding string length and indexing is crucial Building strong fundamentals step by step 💪 #DSA #Java #StringProblems #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
Day: 43/365 📌 LeetCode POTD: Binary Number with Alternating Bits Easy Key takeaways/Learnings from this problem: 1. This one shows how clean bit tricks can replace messy string checks when working with binary patterns. 2. Big takeaway: sometimes a small observation (like using XOR or shifting) turns a pattern problem into a super neat one-liner. #POTD #365DaysOfCode #DSA #Java #ProblemSolving #LearningInPublic #Consistency 🥷
To view or add a comment, sign in
-
-
#day314 of #1001daysofcode problem statement (0693): Binary Number with Alternating Bits Used XOR with right shift to transform alternating bits into a sequence of 1s, then applied the (x & (x + 1)) == 0 pattern(tocheck all bits are set bits or not). Sometimes bit tricks make problems beautifully simple. #1001DaysOfCode #DSA #Java #LeetCode #ProblemSolving Shivam Mahajan #leetcode
To view or add a comment, sign in
-
-
Stop writing code that “just works.” Day 45 / 100 Days of DSA Problem: Find a pair from two arrays whose sum is closest to a target. First approach: Nested loops. Better approach: Two pointers (since arrays are sorted). Move intelligently based on the sum. Time Complexity: O(n + m). Same answer. Smarter thinking. Day 45 lesson: Don’t stop at “it works.” Push for optimal. #Day45 #100DaysOfCode #DSA #Java #ProblemSolving
To view or add a comment, sign in
-
-
Day 32 of DSA 🚀 | Check If a String Contains All Binary Codes of Size K Today’s problem looked straightforward but tested how well I understand constraints and coverage. 🔹 Task: Check whether a binary string contains every possible binary code of length k as a substring. 🔹 Key realization: This is not about generating binary codes. It’s about verifying coverage using a sliding window. 💡 What I learned: Total binary codes of size k = 2^k Sliding window helps examine substrings efficiently HashSet tracks unique patterns automatically Correct boundary (s.length() - k) avoids runtime errors ⏱ Time Complexity: O(n × k) 📦 Space Complexity: O(2^k) 📌 Example: "00110110", k = 2 → all patterns {00, 01, 10, 11} exist → ✅ true This problem reinforced how small details in problem statements can completely change the approach. #DSA #SlidingWindow #Strings #Java #ProblemSolving #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
🚀 Day 18/180 | #180DaysOfCode 📍 LeetCode | 💻 Java Solved: 1528. Shuffle String Used a direct indexing approach by placing each character at its correct position using the given indices array. ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) A simple yet important problem to strengthen understanding of arrays and index mapping. 💪 Consistency continues 🚀 #DSA #LeetCode #Java #CodingJourney #Consistency
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