"First, solve the problem. Then, write the code." - John Johnson Today’s LeetCode session reminded me that the hardest part of engineering isn't typing, it's thinking. I spent 10 minutes drawing a guest list on paper before writing a single line of JavaScript. Result? A clean $O(n)$ solution and a much better understanding of how Sets work. 🚀 #Coding #ProblemSolving #SoftwareEngineering
John Johnson's Coding Tip: Prioritize Problem-Solving Over Coding
More Relevant Posts
-
Day 8 of 30-day Coding Sprint Today’s focus was on a classic problem that teaches you why linear time isn't always good enough when dealing with exponents. Today's progress on LeetCode: 50. Pow(x, n) The Simple Recursive Approach: Multiplying x by itself n times. - Complexity: O(n) time. - The Issue: For large values of n, this hits the stack limit or simply takes too long. The Optimal Strategy: Binary Exponentiation (Divide & Conquer) - The Logic: Use the property (x^n) = (x^n/2)^2. By halving n at each recursive step, we drastically reduce the number of multiplications. The Result: O(log n) time. This turns a billion operations into roughly 30. #30DaysOfCode #DSASprint #LeetCode #JavaScript #Recursion #Math #Consistency
To view or add a comment, sign in
-
-
Closures are often taught as a JavaScript trick. But they’re really about something deeper: identity that survives execution. Philosophers wrestled with this long before code existed. Engineers run into it every day. In this video, I connect classic questions about identity and continuity to how closures actually work under the hood — not as a shortcut, but as a mental model that sticks. No memorization. No magic rules. Just understanding why the language behaves the way it does. If you care about fundamentals, maintainability, and teaching concepts clearly — this perspective might resonate. #JavaScript #FrontendEngineering #SoftwareEngineering #WebDevelopment #EngineeringLeadership #TechnicalFoundations #CodeArchitecture #ProductEngineering #DeveloperExperience #RemoteFriendly #GlobalTech
To view or add a comment, sign in
-
Day 17 of Problem-Solving Discipline 🚀 Today’s focus was LeetCode 3047 – Find the Largest Area of Square Inside Two Rectangles, solved using logical optimization and a clean, readable JavaScript implementation. This problem was a strong reminder that good engineering isn’t about writing more code — it’s about understanding constraints deeply. By applying geometry fundamentals and carefully analyzing boundaries, a brute-force thought process naturally transformed into an efficient and elegant solution. 📌 Key takeaways from today’s practice: • Reducing problems by identifying minimum limiting factors • Shifting mindset from repeated iterations to optimal condition evaluation • Writing code that is not only correct, but readable, maintainable, and test-case safe What I’m learning daily is that consistency beats intensity. Small improvements, practiced regularly, compound into strong problem-solving intuition over time. Showing up every day. One problem at a time. Building long-term engineering strength. #LeetCode #JavaScript #ProblemSolving #DSA #CodingJourney #SoftwareEngineer #DailyConsistency #LearningInPublic
To view or add a comment, sign in
-
-
Day 17 of me reading random and basic but important coding facts.... Today I read about Arrays in JS and turns out, they aren't just simple lists..... Push/Pop vs. Shift/Unshift Push /Pop is very fast as it just adds/removes from the end.... while Shift/Unshift is very slow.....becoz when we remove the first element, the engine has to physically move every single other element to the left to fix the indices....... and another very very interesting fact is that the length property isn't read-only.............. If we set arr.length = 0, it instantly clears the array. If we manually decrease the length (e.g., arr.length = 2), it truncates the data from the end.....and there is no coming back....... So, use them wisely..... Keep Learning!!!!! #javascript #coding #webdevelopment #learning #frontendDev
To view or add a comment, sign in
-
So, debugging is a thing. It's a big deal, actually. You gotta know how to do it right, especially in JavaScript and React - it's like trying to find a needle in a haystack, but the haystack is on fire. Null values, for instance: they're sneaky. Don't check for them, and your code will crash. Boom. Here's the thing: checking for null values is key. It's not that hard, but it's easy to overlook - and that's when things go wrong. You gotta be meticulous, like a detective searching for clues. Not using console logs? That's a mistake too. It's like trying to fix a car without looking under the hood - you need to see what's going on, you know? And then there's edge cases. They're like the weird cousins of the coding world - you don't always think about them, but they can cause some serious problems. So, what's the takeaway? Be careful, and don't be afraid to test things out. It's all about improving those coding skills, and avoiding common mistakes. Check it out: https://lnkd.in/gggPKHwp #Innovation #Creativity #Strategy #Debugging #CodingSkills
To view or add a comment, sign in
-
Mastering the "Hidden" Mechanics of JavaScript 🏗️ To the outside observer, JavaScript looks straightforward. But for developers, the real mastery lies in understanding the asynchronous nature and the execution context of the language. In this guide, I’ve broken down the 7 most critical concepts that distinguish a junior developer from a senior: 🔹 The Event Loop: Understanding the Call Stack and Task Queue. 🔹 Hoisting: Why your variables behave differently than you expect. 🔹 Closures: How functions remember their lexical environment. 🔹 Promises vs. Callbacks: The evolution of clean asynchronous code. Deep-diving into these fundamentals transformed the way I debug and architect my projects. Check out the slides below for a quick refresher! Hashtags: #JavaScript #WebDevelopment #SoftwareDevelopment #Programming #TechCommunity #Engineering #Coding #CareerGrowth #Frontend #LearningAndDevelopment
To view or add a comment, sign in
-
Day 4 of 30-day Coding Sprint Today was a deep dive into Maximum Product Subarray—a classic problem that looks simple until you hit zeros and negative numbers. Today's progress on Leetcode: 152. Maximum Product Subarray - The Brute Force: Nesting loops to check every single subarray. At O(N^3) (or O(N^2) with optimization), it's too much for large datasets. - The Observation: Unlike sums, products are volatile. A single zero resets everything, and a negative number can turn a tiny product into a maximum (or vice versa). - The Optimal Strategy (Prefix & Suffix): By calculating products from both the front (Prefix) and the back (Suffix), you naturally handle the "even vs. odd" negative number count. The Zero Reset: Whenever a product hits 0, I reset to 1 to start a fresh subarray. Result: Clean O(N) time complexity with O(1) space. #30DaysOfCode #DSASprint #LeetCode #JavaScript #Algorithms #Optimization #Consistency
To view or add a comment, sign in
-
-
The journey of a thousand miles begins with a single line of code—and a lot of chai. ☕💻 Spending today diving deep into JavaScript fundamentals and refining my workflow. It’s not about the overnight success; it’s about showing up, writing the code, and sticking to the system. Current Read: Atomic Habits by James Clear. Current Focus: Master the basics. #CodingLife #AtomicHabits #Consistency #WebDev #ContinuousLearning"
To view or add a comment, sign in
-
-
Building Blocks: JavaScript Variables Solidified a core concept today: JavaScript variables. Understanding let, const, and the legacy var is more than just syntax—it's about intent, scope, and writing predictable code. const: for values that shouldn't be reassigned. let: for variables that will change. Understanding scope prevents unexpected bugs. It's a fundamental step, but strong foundations enable everything built on top. Onward to the next concept! #JavaScript #WebDevelopment #Coding #ProgrammingBasics #LearningToCode #SoftwareDevelopment #Tech #Variables
To view or add a comment, sign in
-
-
Do you use TypeScript's infamous "!" (the non-null assertion operator) to silence errors? 😬 ❌ const name = user!.perfil!.name; ✅ const name = user?.perfil?.name?? 'Jon'; If so, beware! While it seems like a quick fix, it can mask real problems and turn your code into a "minefield" of unexpected bugs. Think about it: TypeScript is designed to give us safety. By using "!", we're essentially telling the compiler, "I know what I'm doing, trust me!" But what if you don't? Or if the context changes? 🤔 Instead of forcing TypeScript to accept something, why not explore safer alternatives? - Null Checks: A simple if (variable !== null) can solve a lot! Optional Chaining (?.): Perfect for accessing properties of objects that might be null or undefined, without breaking everything. - Nullish Coalescing (??): Elegantly define a default value if something is null or undefined. - Adopting these practices not only makes your code more robust and easier to maintain, but also helps you better understand your application's data flows. Fewer surprises, more control! 💪 What's your favorite strategy for handling null values in TypeScript? Share in the comments! #TypeScript #Programming #BestPractices #Development
To view or add a comment, sign in
-
More from this author
Explore related topics
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