🚀 [Day 16/30] Coding Challenge Journey with @Educative.io 💻 💡 Problem: Find Longest Self-Contained Substring Today’s challenge was a unique string problem — finding a substring whose characters appear only inside that substring and nowhere else in the entire string. The tricky part? The substring also cannot be the entire string itself. This wasn't a typical sliding window or two-pointer problem, so I had to rethink the approach. My thought process went like this: 1️⃣ Track global character boundaries I first stored the first and last occurrence of every character in the string. This gave me complete information about where each character “lives” inside the string. 2️⃣ Expand substrings smartly Starting from each possible beginning character, I gradually expanded the substring and checked: Do all characters in this substring stay within these boundaries? Is the substring self-contained (i.e., no character appears outside)? 3️⃣ Verify valid windows A substring becomes valid only when: It fully covers all characters within its start–end boundary It is not equal to the full string Every time this condition was satisfied, I tracked its length. This required careful boundary management — but once the logic clicked, the entire substring validation became systematic and efficient ✨ 🔍 Key Learnings: String problems often get easier when you precompute first/last occurrences. Not all problems fit sliding windows — sometimes, boundary-based expansion is the cleaner approach. A substring’s “independence” can be reasoned about using global character positions. ✨ Small win — breaking this problem down into character intervals turned a confusing condition into a clean, workable solution! #30DaysOfCode #Day16 #CodingChallenge #Educative #DSA #JavaScript #StringAlgorithms #ProblemSolving #LearningJourney #KeepCoding
"Day 16: Finding Longest Self-Contained Substring with Educative.io"
More Relevant Posts
-
🚀 Day 4 | 30-Day Coding Challenge – Educative.io Today’s problem: Find the single non-duplicate element in a sorted array. At first, I explored the simple O(n) approaches — 🔹 Using a Set to track duplicates (O(n) time + O(n) space) 🔹 Summing unique vs. total values and finding the difference (O(n) time) 🔹 Linear scan comparing curr and next (O(n) time, O(1) space) All worked… but the goal was O(log n) time and O(1) space. Then it clicked 💡 — since the array is sorted, every pair of equal numbers appears side-by-side. Before the unique element, pairs start at even indices; after it, they start at odd indices. Using this pattern with binary search, I halved the search space each step: if nums[mid] == nums[mid+1] → move right else move left. Every challenge so far is sharpening how I reason about patterns and constraints rather than just syntax. #Day4 #30DaysOfCode #Educative #JavaScript #BinarySearch #ProblemSolving #DSA #LearningInPublic
To view or add a comment, sign in
-
🚀 [Day 15/30] Coding Challenge Journey with @Educative.io 💻 💡 Problem: Similar String Groups Today’s problem was all about identifying relationships between strings and grouping them based on their “similarity.” Two strings are considered similar if they differ in exactly two character positions — meaning you can swap those characters to transform one into the other. My intuition started with this core idea: 👉 If two strings differ by exactly two positions, they belong to the same group. To solve this, I approached the problem like a graph traversal challenge: 1️⃣ Consider each string as a node in a graph. 2️⃣ Create an edge between two nodes if the strings differ by exactly two characters. 3️⃣ Use DFS to explore all connected strings that form a similarity group. 4️⃣ Maintain a visited array to ensure each string is processed once. So for each unvisited string, I triggered a DFS call. That DFS marked all strings connected to it (all strings that were similar by 2-character difference). This naturally formed groups of similar strings — each connected component counted as one group. This problem beautifully reinforced how string similarity + graph connectivity can come together to form a clean and efficient solution 🧠✨ 🔍 Key Learnings: Many string problems hide an underlying graph structure — discovering it is half the solution. DFS is extremely powerful for grouping, clustering, and connectivity problems. A simple rule (differ by 2 characters) can create surprisingly complex group relationships. ✨ Small win — once I mapped the problem to graph traversal instead of brute-force comparisons, everything became much more intuitive! #30DaysOfCode #Day15 #CodingChallenge #Educative #DSA #GraphTheory #DFS #JavaScript #ProblemSolving #StringAlgorithms #LearningJourney #KeepCoding
To view or add a comment, sign in
-
🚀 [Day 11/30] Coding Challenge #30DaysOfCode 💡 Problem: Set Matrix Zeroes Today’s challenge tested my ability to balance time and space complexity efficiently — the task was to modify a matrix such that if any element is 0, its entire row and column should be set to zero. I explored multiple approaches before reaching an optimal one 👇 1️⃣ Brute Force Approach: I iterated through the entire matrix, and whenever I found a 0, I used a helper function to mark all elements in its row and column as -1. After completing this marking process, I did another pass to convert all -1 values to 0. ✅ Simple logic, but inefficient due to multiple passes and extra checks. 2️⃣ Using Extra Arrays: Next, I maintained two separate arrays — one for rows and one for columns — to keep track of which rows and columns should become zero. This improved clarity and avoided redundant marking. 🧠 Time Complexity: O(m × n) | Space Complexity: O(m + n) 3️⃣ Optimized In-Place Solution: Finally, I optimized further by using the first row and first column of the matrix itself as markers — eliminating the need for extra space. This reduced the space complexity to O(1) while maintaining O(m × n) time complexity. ✨ It was fascinating to see how a small shift in perspective (reusing the same matrix for storage) made the solution much more elegant and efficient. 🔍 Key Takeaways: Always aim to optimize space without compromising clarity. Sometimes, the best memory to use is the one already in use! 😄 Breaking a problem into stages (brute force → optimized) builds strong problem-solving intuition. eager for next day challenge with Educative. #Day11 #CodingChallenge #Educative #DSA #ProblemSolving #JavaScript #LearningJourney #KeepCoding #Matrix #Optimization #CleanCode
To view or add a comment, sign in
-
Day 35 Today’s session was all about problem-solving in JavaScript. We practiced different logic-based questions using for loops, if-else conditions, and a few real-world scenarios to strengthen our understanding of core concepts. These kinds of sessions really help in improving logical thinking and building a stronger coding foundation Guided by Harsh Vandana Sharma at Sheryians Coding School #JavaScript #ProblemSolving #WebDevelopment #LearningJourney #Coding #SheryiansCodingSchool
To view or add a comment, sign in
-
-
Day 33 — Loops & Conditions Practice | 2.0 Job-Ready AI-Powered Cohor Sheryians Coding School🚀 Today was all about hands-on coding with JavaScript loops & conditionals. Practiced real logic-building exercises like: ✅ Print numbers 1 to 10 ✅ Print even numbers using loops + condition ✅ Print numbers 10 to 1 (reverse loop) ✅ Print "YES" 5 times using a loop ✅ Ask a number → check positive or negative ✅ Ask user's age → check voting eligibility ✅ Multiplication table of 5 using loop ✅ Understand & handle edge cases with if-else The more I practice these logic patterns, the more comfortable I get with problem-solving in JavaScript 💪 #JavaScript #WebDevelopment #Frontend #CodingPractice #SheryiansCodingSchool #100DaysOfCode #DeveloperJourney
To view or add a comment, sign in
-
-
#Day47 of Sheryians Coding School 🚀 1️⃣Self Study: Events & Event Handling (Part 2) Explored advanced event behavior and control in JavaScript. preventDefault() - Stops default browser actions. Example: Preventing page reload on form submit. Event Delegation: Instead of adding event listeners to multiple child elements, attach one listener to the parent and detect which child triggered it. Efficient for dynamic elements. Event Bubbling: Event travels from child → parent. Happens by default. Event Capturing: Event travels from parent → child first. Enabled by passing true as the third parameter in addEventListener. Learned that every event has two phases in its lifecycle: Capturing Phase Bubbling Phase Understanding these phases helped clarify how event flow actually works inside the browser. 2️⃣Self Task: Continued on previous webpage Updated the Event Collection Webpage with: preventDefault implementation Event bubbling examples Event capturing demos Event delegation interactive section Experimentation helped solidify the concepts better. This marks the completion of the webpage module Source: https://lnkd.in/dHJprsvy Live: https://lnkd.in/dVCQtpcx 3️⃣Live Class: Practiced logic-building JS questions. Focused on breaking problems into smaller steps and reasoning clearly. ✨ Key Highlights: Gained deeper clarity on how events flow in the DOM. Learned to write more efficient JS using event delegation. Completed a hands-on project consolidating part 1 + part 2 of events. Improved debugging skills by observing behavior in dev tools. #update #progress #coding #journey #frontend #development #javascript #DOM #manipulation #improving
To view or add a comment, sign in
-
#Day49 of Sheryians Coding School🚀 1️⃣Self Study: Timers & Intervals Learned how JavaScript handles timing-based actions. setTimeout() → Executes a function after a delay. setInterval() → Executes a function repeatedly at intervals. clearTimeout() → Stops a scheduled timeout by passing its ID. clearInterval() → Stops a continuous interval by passing its ID. Practiced multiple small examples to understand them thoroughly. 2️⃣Self Task: Hands-on Practice (CodePen) Created a banner that disappears after 2 seconds when a button is clicked using setTimeout(). Created a download progress bar that completes over 3 seconds using setInterval(). Doing these practicals helped build logical structure + event + timing understanding. Codepen: https://lnkd.in/dZx8NpRp 3️⃣Live Class: Functions Revised what functions are and why they are needed. Learned about: Function Declaration Function Expression Higher Order Functions Callback Functions IIFE (Immediately Invoked Function Expressions) First Class Functions Understood how functions can be treated as values and passed around. 🌟 Key Highlights Strengthened understanding of time-based execution flow in JavaScript. Practical tasks made theoretical concepts feel real and usable. Started exploring functional programming ideas like callbacks & higher-order functions. Feeling more confident applying JS logic to real UI behaviors. #update #progress #coding #journey #practice #learning #frontend #development #improving #javascript
To view or add a comment, sign in
-
#Day55 of Sheryians Coding School🚀 1️⃣Self Study: this Keyword and Function Binding Learned about the special this keyword in JavaScript and how its value depends on where and how it is used. Key takeaways: In the global scope, this refers to the window object (or undefined in strict mode). Inside a regular function, this also refers to the window object (unless strict mode is enabled). Inside an object method (ES5-style), this refers to the object that called the method. Inside a class, this refers to the instance of that class. Inside an arrow function, this does not have its own value: it inherits this from its parent lexical scope. Learned about binding functions that manually control this: call(obj, ...args) → invokes immediately with this = obj. apply(obj, [args]) → similar to call() but accepts arguments as an array. bind(obj) → returns a new function with this permanently bound to the provided object. 2️⃣Self Task: Add User with Cards This task was created based on whatever I learned today. In this task, I made use of the this keyword and explored how to use bind() to bind an object to this when a function is called. It was a new way of programming that helps prevent global pollution and makes the code more modular and organized. At first, I was confused about why it really matters, but later I understood the difference modular code is easier to manage, while global pollution makes the code harder to maintain. Source: https://lnkd.in/d682cTW9 Live: https://lnkd.in/dDFFHnjF 🌟 Key Highlights Gained strong conceptual clarity on this keyword and its different behaviors. Practically implemented function binding (bind, call, apply) in a real project. Understood the importance of modular programming and avoiding global pollution in JS. #update #progress #coding #journey #frontend #development #improving #javascript #this #keyword #mini #task
To view or add a comment, sign in
-
Day 31 — Operator Practice Session | 2.0 Job-Ready AI-Powered Cohort Sheryians Coding School🚀 Today was all about hands-on JavaScript operator practice — not just learning, but reinforcing by writing code 👨💻🔥 ✅ Practiced Arithmetic Operators let a = 5, b = 3; console.log(a+b, a-b, a/b, a*b); let x = 5; x += 3; x *= 3; x /= 3; ✅ Increment / Decrement let count = 5; console.log(count); count++; console.log(count); count--; // and also --count ✅ Comparison Operators 5 == "5" // true 5 === "5" // false ✅ Checking conditions: 10 > 5 10 < 20 10 === 10 ✅ Logical Operators true && false true || false !true ✅ Variable Hoisting Practice Revising fundamentals with code is helping me strengthen problem-solving and execution flow understanding 💡 #JavaScript #WebDevelopment #Frontend #PracticeMakesPerfect #SheryiansCodingSchool #LearningByDoing
To view or add a comment, sign in
-
-
Day 39 of Cohort 2.0 🚀 Today’s session was all about diving into Objects in JavaScript and applying concepts through practical problem-solving. 💻 Here’s what I learned today: 🔹 Objects in JavaScript → Store data in key-value pairs for structured and organized coding 🔹 Accessing & Modifying Object Properties → Learn how to read, update, and delete data dynamically 🔹 Functions + Arrays + Objects Practice → Strengthened logic by solving real-world coding problems combining all three concepts ✨ Key takeaway: Understanding how to work with objects and integrating them with arrays and functions makes JavaScript code more powerful, modular, and efficient. Sheryians Coding School #sheryianscodingschool #cohort2 #learningjourney #dailyupdates #JavaScript #WebDevelopment #Frontend
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