<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Megha B H on Medium]]></title>
        <description><![CDATA[Stories by Megha B H on Medium]]></description>
        <link>https://medium.com/@megha_bh?source=rss-49e4df97cd59------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jT4MA2QnHm3LO4Gm16Qr-Q@2x.jpeg</url>
            <title>Stories by Megha B H on Medium</title>
            <link>https://medium.com/@megha_bh?source=rss-49e4df97cd59------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 20:51:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@megha_bh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Monotonic Stack Playbook | A Visual Guide with Mind Map]]></title>
            <link>https://medium.com/@megha_bh/monotonic-stack-playbook-a-visual-guide-with-mind-map-e07f24f14e17?source=rss-49e4df97cd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/e07f24f14e17</guid>
            <dc:creator><![CDATA[Megha B H]]></dc:creator>
            <pubDate>Tue, 24 Jun 2025 14:45:43 GMT</pubDate>
            <atom:updated>2025-06-25T17:42:33.984Z</atom:updated>
            <content:encoded><![CDATA[<h4>Save this for your next interview prep! Visual learners and pattern-spotters, you’ll love what’s inside.</h4><p>Hey there! Ever stumbled across a coding problem that keeps asking for the “next greater” or “previous smaller” element? Sounds familiar, right?</p><p>That’s where the Monotonic Stack quietly steps in. It is one of those underrated <strong>coding patterns</strong> in many <strong>DSA stack problems</strong> and <strong>interview questions</strong>, especially in platforms like Leetcode and FAANG rounds.</p><p>In this article, you’ll learn:</p><ul><li><em>What a Monotonic Stack is (in simple terms)</em></li><li><em>When and how to apply the right variant (cue card)</em></li><li><em>Real-world coding examples</em></li><li><em>Common traps</em></li><li><em>A quick self-check quiz at the end</em></li></ul><h3><strong>The Stack that plays by the rules</strong></h3><p>A <strong>Monotonic Stack</strong> is just a regular stack with a personality. We push and pop elements <em>only if</em> they maintain the desired order.</p><blockquote>Think of it like stacking books on a shelf, where each book must be taller (or shorter) than the one before it to keep the aesthetic. If a new book breaks the visual flow, you remove some until the stack looks right again. It’s less about storing everything, and more about maintaining the right sequence.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*vZe6P6nCBV_mLqvtrKm9Cw.png" /></figure><p><strong><em>Types of Monotonic Stack</em></strong></p><ul><li><strong>Monotonically Increasing stack</strong> → <em>largest element at the top</em><br> This type keeps elements in <strong>ascending order from bottom to top</strong>. That means the <strong>top of the stack holds the largest valid element</strong> so far. As you scan through the array, you add a new element <strong>only if it’s greater than or equal to</strong> the top of the stack.<br> If the current element is <strong>smaller</strong>, you <strong>pop</strong> from the stack until the increasing order is restored.<br><em>Use this pattern when solving for </em><strong><em>Next Smaller</em></strong><em> or </em><strong><em>Previous Smaller</em></strong><em> elements.</em></li></ul><pre># Initialize an empty stack<br># For each number in the array:<br>  ## While the stack is not empty and the top of the stack is greater than the current number:<br>     ### Pop the top element from the stack<br>  ## Push the current number onto the stack<br><br>stack = []<br>for num in arr:<br>while stack is not empty AND stack.top() &gt; num:<br>stack.pop()<br>stack.push(num)</pre><ul><li><strong>Monotonically</strong> <strong>Decreasing stack</strong> → <em>smallest element at the top</em><br> This stack keeps elements in <strong>descending order from bottom to top</strong>, so the <strong>top holds the smallest valid element</strong>. You add a new element <strong>only if it’s smaller than or equal to</strong> the top of the stack. If the current element is <strong>greater</strong>, you <strong>pop</strong> from the stack until the decreasing order is restored.<br><em>Use this pattern when solving for </em><strong><em>Next Greater</em></strong><em> or </em><strong><em>Previous Greater</em></strong><em> elements.</em></li></ul><pre># Initialize an empty stack<br># For each number in the array:<br>  ## While the stack is not empty and the top of the stack is less than the current number:<br>    ### Pop the top element from the stack<br>  ## Push the current number onto the stack<br><br>stack = []<br>for num in arr:<br>while stack is not empty AND stack.top() &lt; num:<br>stack.pop()<br>stack.push(num)</pre><h3><strong>Intuition comes before implementation</strong></h3><p>Before you worry about which variant to use, let’s pause and get the feel of it.</p><blockquote>Imagine you’re walking through an array, and at each step, you’re only interested in the <strong>next bigger</strong> or <strong>next smaller</strong> element. But instead of checking everything ahead manually, you carry a smart little stack that filters out the noise for you.</blockquote><p>That’s what a <strong>monotonic stack</strong> does — it <strong>keeps only the elements that still have a chance of being the answer</strong>, and pops out anything that no longer helps. It’s not about storing everything — it’s about holding onto <strong>what matters</strong>.</p><p>Which elements get popped and which stay depends on two things:</p><ul><li><strong>Which direction you’re scanning</strong> (<em>Left ➝ Right or Right ➝ Left</em>)</li><li><strong>What you’re looking for</strong> (<em>greater or smaller</em>)</li></ul><p>Once you get this idea — that you’re not collecting answers, you’re <strong>curating them</strong> — choosing the right variant becomes second nature.<br> Problems rarely say, <em>“Hey, use Monotonic Stack!”</em><br> But if you catch yourself comparing the current element to some future or past value, chances are, your stack is waiting to shine.</p><h3><strong>Stack Selector Cheatsheet</strong></h3><p><em>Stop guessing — here’s the formula that always works.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*tNYn2bll_f_Q0E2sBeQa_A.png" /><figcaption>📌<em>Stack Selector Cheatsheet: Your go-to guide for common </em><strong><em>DSA stack problems</em></strong><em> and their Monotonic Stack solutions.</em></figcaption></figure><blockquote>And if you’re a visual learner, I break down patterns like this with diagrams and real examples on YouTube: <a href="http://redirect.medium.systems/r-3aQThsGgBB?source=email-49e4df97cd59-1750510530205-newsletter.subscribeToProfile--af285ea25248-----------------------dbb1f359_1e92_4689_8b2f_d8659b4af82b--------98be842c42ce">@mindgorithm</a> — where <strong>mindset meets DSA</strong>.<br>Follow for byte-sized breakdowns, cheat codes, and relatable prep motivation.</blockquote><h3><strong>Real-World Coding Patterns &amp; Monotonic Stack Interview Questions (Spot These!)</strong></h3><p>Let’s explore where monotonic stacks quietly power through in real interviews:</p><p>🔥<strong>Daily Temperatures</strong><br> <em>“How many days until it gets warmer?”</em><br> → Sounds like <strong>Next Greater Element</strong> (NGE).<br> <a href="http://redirect.medium.systems/r-HwLCriM9Ul?source=email-49e4df97cd59-1750510530205-newsletter.subscribeToProfile--af285ea25248-----------------------dbb1f359_1e92_4689_8b2f_d8659b4af82b--------98be842c42ce">LeetCode #739</a></p><p>📈 <strong>Stock Span Problem</strong><br> <em>“How many previous days had lower prices?”</em><br> → Classic <strong>Span Aggregation with Monotonic Stack</strong><br> <a href="http://redirect.medium.systems/r-Qzg3aLCzC5?source=email-49e4df97cd59-1750510530205-newsletter.subscribeToProfile--af285ea25248-----------------------dbb1f359_1e92_4689_8b2f_d8659b4af82b--------98be842c42ce">LeetCode #901</a></p><p>📊<strong>Largest Rectangle in Histogram</strong><br> <em>“What’s the biggest rectangle I can make?”</em><br> → Use <strong>both</strong> NSE and PSE to find boundaries.<br> <a href="http://redirect.medium.systems/r-baBodiiL2_?source=email-49e4df97cd59-1750510530205-newsletter.subscribeToProfile--af285ea25248-----------------------dbb1f359_1e92_4689_8b2f_d8659b4af82b--------98be842c42ce">LeetCode #84</a></p><p>🔄<strong>Next Greater Element (Circular Array)</strong><br> <em>“Find the next greater number — but wrap around if needed.”</em><br> → Standard NGE, with a twist: loop <strong>twice</strong> using i % n.<br> <a href="http://redirect.medium.systems/r-3yHo9zowLf?source=email-49e4df97cd59-1750510530205-newsletter.subscribeToProfile--af285ea25248-----------------------dbb1f359_1e92_4689_8b2f_d8659b4af82b--------98be842c42ce">LeetCode #503</a></p><p>🌧️<strong>Trapping Rain Water</strong><br> <em>“How much water is trapped between the bars?”</em><br> → Use a monotonic stack to track boundaries from both sides.<br> <a href="http://redirect.medium.systems/r-lb0MIGw49W?source=email-49e4df97cd59-1750510530205-newsletter.subscribeToProfile--af285ea25248-----------------------dbb1f359_1e92_4689_8b2f_d8659b4af82b--------98be842c42ce">LeetCode #42</a></p><blockquote>These are pattern-recognition goldmines for interviewers — knowing how to decode the underlying stack logic gives you an edge. <em>These patterns won’t always shout “Monotonic Stack,” but if you’re comparing current values to earlier or later ones, it’s probably time to bring out the stack.</em><br> <strong><em>These are your must-practice problems before any interview.</em></strong></blockquote><h3><strong>Time &amp; Space Complexity — Why It’s Interview Gold</strong></h3><p>Let’s break it down without the jargon:</p><ul><li><strong>Time Complexity: O(n)</strong><br> Even though there’s a loop inside a loop, every element is pushed and popped <strong>at most once</strong>. That means the total work stays linear — no sneaky quadratic behaviour here. It’s way more efficient than brute-force approaches.</li><li><strong>Space Complexity: O(n)</strong><br> You’re using a stack to temporarily hold elements or indices. In the worst case, the stack holds all n elements, but that’s still linear.</li></ul><blockquote>Bottom line: Monotonic Stacks give you optimal performance, both in time and space, one of the reasons they’re a <strong>favorite in interviews</strong>.</blockquote><h3><strong>Common Pitfalls &amp; Edge Cases (Watch Out!)</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*lqCpFeR2aS4hmNJnMwb3ew.png" /><figcaption>⚠️</figcaption></figure><p>Even seasoned coders can trip over these sneaky cases. Here’s what to look out for — and how to avoid them:</p><p>🔁<strong>Handling Duplicates</strong><br> Duplicates can change everything. Should equal elements count or cancel each other out? The key is in your comparison operator (&gt;=, &lt;=, &lt;, &gt;). Read the question carefully — don’t assume all duplicates behave the same.</p><p>🆔<strong>Forgetting to Track Indices</strong><br> Some problems care about <em>positions</em>, not <em>values</em>. So instead of pushing the value onto the stack, push the index i. This allows you to calculate ranges, distances, or spans later.</p><p>🌀<strong>Circular Arrays</strong><br> These wrap around, so your loop needs to simulate two passes (e.g.,<em> 2 * n</em> iterations), and you use <em>i % n</em> to stay within bounds. Don’t forget this trick, it’s common in “next greater in circular array” types.</p><p>➖<strong>Off-by-One Mistakes</strong><br> Tiny loop errors = wrong results. Are you going Left → Right or Right → Left? Starting from the right index? Carefully check your loop bounds and comparison logic. One missed = can flip your output.</p><p>🚫<strong>Empty Stack Errors</strong><br> Accessing stack.top() or stack[-1] when the stack is empty? Boom — runtime error. Always check if the stack is not empty before peeking or popping.</p><h3><strong>Quiz Zone: Are You Monotonic-Stack Ready?</strong></h3><blockquote>Let’s put your Monotonic Stack instincts to the test.<br> No options, no pressure — just 5 rapid-fire questions to check if the concepts <strong>clicked</strong>.</blockquote><ol><li>You’re finding the previous greater element — which direction do you scan, and what do you pop?</li><li>In the stock span problem, what exactly are you pushing onto the stack to calculate span?</li><li>For trapping rainwater, how does the monotonic stack help define left and right boundaries?</li><li>You need the next smaller number for each value — which type of stack are you building?</li><li>You’re solving daily temperatures — what’s the variant, and why is index tracking important?</li></ol><h3><strong>Final Thoughts</strong></h3><p>If these felt easy, you’re on your way to spotting Monotonic Stack problems like a pro.<br>If any question made you pause, your brain tells you exactly what to revisit. 🔙Scroll back, scan the cues, and stack that confidence.</p><p><strong><em>P.S.</em></strong><em> Drop your answers in the comments or DM me on </em><a href="http://redirect.medium.systems/r-xS2Map2tpq?source=email-49e4df97cd59-1750510530205-newsletter.subscribeToProfile--af285ea25248-----------------------dbb1f359_1e92_4689_8b2f_d8659b4af82b--------98be842c42ce"><em>Instagram </em></a><em>— I’d love to see your progress!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e07f24f14e17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Limits to Leaps: Embracing the Transformative Power of Growth Mindset]]></title>
            <link>https://medium.com/@megha_bh/from-limits-to-leaps-embracing-the-transformative-power-of-growth-mindset-c2838cae62b2?source=rss-49e4df97cd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2838cae62b2</guid>
            <category><![CDATA[fixed-mindset]]></category>
            <category><![CDATA[growth-mindset]]></category>
            <category><![CDATA[power-of-mind]]></category>
            <dc:creator><![CDATA[Megha B H]]></dc:creator>
            <pubDate>Sat, 30 Mar 2024 22:09:52 GMT</pubDate>
            <atom:updated>2024-03-30T22:25:26.978Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Redefine possibilities; take the leap towards your dreams with a growth mindset.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/0*vCZY8kJKe9hDakwO" /></figure><p>Hey, have you ever heard that nagging voice inside whispering, <em>‘I’ll never be good enough,</em>’ or ‘<em>This is too daunting’?</em> or <em>‘I’m just not cut out for this’</em>. Those murmurs could be a telltale sign of a fixed mindset. But what exactly does that imply, and how does it shape our journey? Let’s delve into the fascinating world of mindsets, where our beliefs about our abilities can either propel us forward or hold us back.</p><p>Imagine a world where challenges are merely stepping stones, failures are valuable lessons, and success is not just a destination, but a journey of continuous growth. Welcome to the realm of the growth mindset — a transformative approach to life that ignites a fire within, propelling you towards your fullest potential. In this captivating journey, limitations dissolve into opportunities, setbacks become launching pads, and self-doubt evolves into unshakable confidence. <em>Embark with me on a quest to discover the untapped reservoirs of your own capabilities, as I unravel the secrets to unleashing the boundless power of your mind.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*ya2Xcp8i3w1wHmB0.jpg" /></figure><h4>What is mindset?</h4><p>At its heart, mindset is simply the way you see and approach the world. Whether you realize it or not, your mindset shapes how you think, feel, and act in different situations.</p><blockquote><em>In essence, there are two main types of mindsets:</em></blockquote><ul><li>Growth Mindset</li><li>Fixed Mindset</li></ul><blockquote>Imagine these mindsets as the different lenses through which you perceive the world. With a growth mindset, it’s like wearing glasses that constantly adjust to focus on opportunities for learning and development. Challenges are seen as stepping stones to progress, and setbacks are viewed as temporary hurdles on the path to success. Individuals with a growth mindset embrace effort and persist through difficulties, believing that their abilities can be cultivated and expanded over time. Conversely, a fixed mindset is akin to wearing glasses that stubbornly cling to a narrow perspective. Here, challenges are daunting obstacles that confirm limitations, and setbacks are perceived as insurmountable barriers. Those with a fixed mindset may shy away from challenges, fearing failure and viewing their abilities as innate traits that cannot be changed. Understanding the distinction between these mindsets is crucial, as it can profoundly impact how we approach life’s challenges and opportunities.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TJmgynMN5WVwAzZ3.jpeg" /></figure><h4><strong>Which Mindset Do You Have?</strong></h4><p><strong>Pause and ponder:</strong> When confronted with challenges, <em>do you perceive them as opportunities for growth or as insurmountable obstacles? How do you typically react to setbacks — with resilience and determination, or with discouragement and defeat?</em> Recognize that both mindsets reside within us all, surfacing in various circumstances. Are you aware of when each mindset emerges in your life? By understanding these tendencies, we gain valuable self-awareness, empowering us to make mindful choices amidst life’s ebb and flow.</p><blockquote>Let’s take a moment to reflect on our approach to challenges. Consider a time when you faced a difficult task at work or school. Did you see it as an opportunity to learn and improve, or did you feel overwhelmed and defeated before even trying? Think about how you respond to setbacks — perhaps a project didn’t go as planned, or you received constructive criticism. Do you bounce back with determination, eager to learn from the experience, or do you feel disheartened and doubt your abilities?</blockquote><p>These scenarios illustrate the difference between a growth mindset and a fixed mindset. In the first example, someone with a growth mindset views challenges as opportunities for personal and professional development. They approach tasks with enthusiasm, knowing that even if they stumble along the way, they can learn and grow from the experience. On the other hand, someone with a fixed mindset may shy away from challenges, fearing failure and believing that their abilities are limited.</p><p>Now, think about how these mindsets manifest in your daily life. Maybe you’re learning a new skill, like cooking or playing a musical instrument. Do you embrace the learning process, relishing in the opportunity to improve, or do you become frustrated and give up at the first sign of difficulty? Or consider how you handle feedback from others — do you welcome constructive criticism as a chance to grow, or do you feel defensive and dismissive?</p><p>By examining these everyday scenarios, we can gain insight into our own mindset tendencies. <strong>Remember, it’s not about labelling ourselves as solely having a growth or fixed mindset. Rather, it’s about recognizing that we all possess elements of both within us, and our mindset can shift depending on the situation.</strong> Developing self-awareness around our mindset allows us to make intentional choices about how we approach challenges and setbacks, ultimately fostering personal growth and resilience in the face of adversity.</p><h4>Identifying fixed mindset tendencies enables individuals to:</h4><ul><li>Gain Self-awareness: <em>Recognizing fixed mindset tendencies provides individuals with valuable insights into their own thought patterns and behaviors. This heightened self-awareness enables them to identify areas where they may be holding themselves back. Armed with this knowledge, individuals can make deliberate efforts to challenge these tendencies and cultivate a mindset that fosters personal growth and resilience.</em></li><li>Challenge Limiting Beliefs: <em>Identifying fixed mindset tendencies empowers individuals to confront and overcome self-imposed limitations, unlocking their full potential.</em></li><li>Enhance Problem-Solving Skills: <em>When individuals are aware of fixed mindset tendencies, they are better equipped to approach challenges with a growth-oriented mindset. This awareness enables them to view obstacles as opportunities for learning and innovation rather than insurmountable barriers. As a result, individuals develop the resilience and creativity necessary to navigate complex problems effectively, finding innovative solutions and adapt to changing circumstances with confidence.</em></li><li>Build Resilience: <em>Recognizing fixed mindset tendencies enables individuals to build resilience effectively, bouncing back from setbacks and obstacles with determination.</em></li><li>Foster a Culture of Growth: <em>Identifying fixed mindset habits helps create an environment where people are encouraged to keep learning and getting better, whether it’s in their personal lives or at work. This means that when people understand and tackle their fixed mindset tendencies, they’re more likely to see challenges as chances to grow and improve. This mindset spreads to the whole group or organization, making everyone more open to learning new things and becoming better at what they do.</em></li></ul><p>Now that we understand the significance of recognizing mindset tendencies and the value of cultivating a growth mindset, let’s explore the factors that can trigger a fixed mindset and strategies for changing a fixed mindset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*3x-Rsz1EVxTkfOHM.gif" /></figure><h4><strong>Triggers of Fixed Mindset</strong></h4><p>Fixed mindset triggers are situations or remarks that push you towards believing that your abilities are fixed and cannot be improved. Picture moments when you feel like giving up on something because you think you’ll never be good at it, no matter how hard you try.</p><ul><li>One common trigger is when someone tells you that you’re not skilled at something. This kind of feedback can make you feel like your abilities are set in stone.</li><li>Another trigger is when people make a big deal out of your mistakes, making you feel like you’re not cut out for what you’re attempting.</li><li>Similarly, being rescued from failure by others can also reinforce a fixed mindset. For instance, if someone constantly steps in to prevent you from failing, it may lead you to believe that you’re not capable of succeeding on your own.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*O9NUELQtQTb567S7.jpg" /></figure><h4><strong>Strategies to overcome the fixed mindset</strong></h4><ol><li>Challenge Negative Thoughts: <em>Question the validity of your negative thoughts. For instance, ask yourself, “Is there evidence to support the idea that I’ll never improve?”</em></li><li>Practice Self-Compassion: <em>Treat yourself with kindness and understanding. Instead of criticizing yourself for making mistakes, remind yourself that everyone learns through trial and error.</em></li><li>Process Praise: <em>Process praise is like giving credit for the hard work and effort someone puts into something, rather than just saying they’re naturally good at it. It’s about acknowledging the steps they took to learn and get better, rather than focusing solely on their innate abilities. So instead of just saying “You’re talented,” you might say “You really worked at this and made great progress!” It’s all about recognizing the journey of improvement and encouraging it.<br></em>Process praise, as advocated by Dweck, serves as a powerful strategy for shifting from a fixed mindset to a growth mindset. Give process praise a shot for yourself as well. If you find yourself making excuses, pointing fingers at others for your setbacks, or believing your abilities are fixed, give process praise a try. Instead, focus on acknowledging the effort you’ve exerted and the strategies and resources you’ve utilized to improve. Dweck recommends being matter-of-fact and not too strong or passive with your process praise. Be direct without being harsh or too accommodating.</li><li>Keep Failure in Perspective: <em>Acknowledge that failure is a natural part of the learning process. Refrain from overreacting to setbacks and maintain perspective to avoid slipping into a fixed mindset.</em></li><li>Reflect and Revise: <em>Set aside time for introspection to evaluate your progress and plan for improvement. Recognize that while effort is essential, refining strategies is equally vital for nurturing a growth mindset.</em></li><li>Recognize the Trigger: <em>Notice when you start doubting yourself or feeling discouraged. Whenever you encounter a fixed mindset trigger, talk back to it with a growth mindset voice. A growth mindset voice is a positive affirmation that reminds you of your potential and encourages you to keep trying. To practice this technique, you can use a journal or a note app to write down your inner dialogues. Whenever you feel stuck or discouraged, you can review your journal or notes and repeat your growth mindset statements out loud or in your head. This will help you change your perspective and boost your confidence. Here are common fixed mindset triggers and corresponding growth mindset statements:</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*MS5Gv3dAh7Bbe6FiDNkLjQ.png" /></figure><h3>The Takeaway</h3><p>Remember, transforming your mindset is a journey that demands persistence and dedication. It won’t be easy, but the rewards are profound. Embrace the challenge, commit to the process, and watch as your life transforms in ways you never imagined possible.</p><blockquote>As Ralph Waldo Emerson wisely said,</blockquote><blockquote>‘What lies behind us and what lies before us are tiny matters compared to what lies within us.’</blockquote><p>So, believe in your inner strength, start your journey towards a growth mindset today, and unlock your full potential!</p><p><em>Did the steps in this article resonate with you? Are you ready to reshape your mindset and make a positive change in your life?<br>Why not give it a try today and see the difference it makes?</em></p><p>Drop in the comment section to let me know if this works and if you have any suggestions.</p><p><strong>Thanks! Signing off!</strong></p><p><strong>Megha B. Halasangimath</strong></p><p><a href="https://www.linkedin.com/in/megha-halasangimath/">LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2838cae62b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering the Sliding Window Technique: A Visual Guide with Mind Map]]></title>
            <link>https://medium.com/@megha_bh/mastering-the-sliding-window-technique-a-visual-guide-with-mind-map-751cebf936e0?source=rss-49e4df97cd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/751cebf936e0</guid>
            <category><![CDATA[mindmap]]></category>
            <category><![CDATA[sliding-window-algorithm]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming-pattern]]></category>
            <category><![CDATA[dsa-courses]]></category>
            <dc:creator><![CDATA[Megha B H]]></dc:creator>
            <pubDate>Sun, 10 Sep 2023 19:35:15 GMT</pubDate>
            <atom:updated>2025-06-21T03:52:26.989Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey there! Ever heard of the “Sliding Window” technique in programming? Don’t worry if it sounds a bit perplexing; we’re here to break it down for you in plain, conversational terms. In this chat, we’ll explore what the sliding window pattern is, how to spot scenarios where it comes in handy, and we’ll even discuss its time and space complexities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lcfE6u6wcUj7qxVY34Zidw.gif" /><figcaption>Sliding Window</figcaption></figure><h4>What’s This Sliding Window Pattern All About?</h4><p>Now, let’s talk about when to pull out this technique from your programming toolbox. You’d want to consider using the sliding window pattern in situations like these:</p><p><strong>1. Subarray or Substring Problems:</strong> Imagine you need to find the longest or shortest subarray or substring that meets certain criteria (like having the maximum sum or distinct elements). Well, that’s the sliding window’s sweet spot.</p><p><strong>2. Fixed-Size Data Extraction:</strong> Sometimes, you need to process data within a fixed-size window or subarray. Think of it as extracting insights from a particular chunk of data. This pattern makes it a breeze.</p><p><strong>3. Two-Pointer Approach:</strong> In some cases, you can think of the sliding window as a two-pointer approach, where two pointers (usually the left and right) roam through your data while maintaining a specific window size.</p><h4>How Do You Actually Use It?</h4><p>So, you’re sold on trying out the sliding window pattern? Awesome! Here’s a quick guide on how to implement it:</p><p><strong>Step 1:</strong> Define Your Window: First things first, you define the window size or boundaries. Most of the time, you’ll have two pointers, one marking the start and the other the end of the window. Set them up accordingly.</p><p><strong>Step 2:</strong> Slide the Window: Now comes the fun part! Start moving your window by incrementing the end pointer. While you do this, keep track of any relevant data within that window.</p><p><strong>Step 3:</strong> Check the Constraints: At each step, give a look-see to check if the current window satisfies your problem’s constraints or requirements. If it does, update your result or do whatever needs to be done.</p><p><strong>Step 4:</strong> Adjust the Window: If the window no longer meets the constraints, don’t fret. Simply adjust it by incrementing the start pointer while ensuring the window’s size stays constant.</p><p><strong>Step 5:</strong> Rinse and Repeat: Keep sliding and adjusting that window until you’ve worked through the entire array or list. Eventually, you’ll get the result you’re aiming for.</p><h4>Are there any types?</h4><p>Yes, the sliding window pattern can be categorized into two main types: fixed-size windows and dynamic-size windows.</p><p>Let’s explore each type with examples:</p><p><strong>1. Fixed-Size Window:</strong> In a fixed-size window, the size of the window remains constant as it slides through the data. This type of sliding window is particularly useful when you need to process data within a fixed range or for a specific length of elements.</p><p><em>Example: Maximum Sum Subarray (Fixed-Size Window)</em></p><p><em>Suppose you have an array of integers and want to find the maximum sum of a subarray with a fixed size `k`. Here’s an example in Python:</em></p><pre>def max_sum_subarray(arr, k):<br>    window_sum = sum(arr[:k])<br>    max_sum = window_sum<br>    <br>    for i in range(k, len(arr)):<br>        window_sum += arr[i] - arr[i - k]<br>        max_sum = max(max_sum, window_sum)<br>    <br>    return max_sum</pre><p><em>Example usage</em></p><pre>arr = [2, 1, 5, 1, 3, 2]<br>k = 3<br>result = max_sum_subarray(arr, k)<br>print(result)  # Output: 9</pre><p><em>In this example, the sliding window has a fixed size of `k=3`, and it moves through the array to find the maximum sum subarray of that size.</em></p><p><strong>2. Dynamic-Size Window: </strong>In a dynamic-size window, the size of the window can change as it slides through the data. This type of sliding window is used when the problem requires adjusting the window size based on specific conditions or constraints.</p><p><em>Example: Longest Subarray with Sum at Most K (Dynamic-Size Window)</em></p><p><em>Let’s say you have an array of positive integers and a target sum `k`, and you want to find the length of the longest subarray whose sum is at most `k`. Here’s an example in Python:</em></p><pre>def max_length_subarray(arr, k):<br>    max_len = 0<br>    window_sum = 0<br>    left = 0<br><br>    for right in range(len(arr)):<br>        window_sum += arr[right]<br><br>        while window_sum &gt; k:<br>            window_sum -= arr[left]<br>            left += 1<br><br>        max_len = max(max_len, right - left + 1)<br><br>    return max_len</pre><p><em>Example Usage</em></p><pre>arr = [1, 2, 3, 4, 1, 1, 1]<br>k = 5<br>result = max_length_subarray(arr, k)<br>print(result)  # Output: 3 </pre><p><em>In this dynamic-size window example, the window adjusts its size based on the condition that the sum of elements within the window should be at most `k`.</em></p><p>Both fixed-size and dynamic-size sliding window patterns have their applications and are powerful tools for efficiently solving a wide range of problems in programming and data analysis.</p><h4>Time and Space Complexity?</h4><p>Now, let’s chat about efficiency. The sliding window pattern’s time complexity usually falls in the range of <strong><em>O(N) to O(N²)</em></strong>, depending on the specific problem and window size. In most cases, it’s a significant improvement over brute force approaches, which can have a time complexity of O(N³) or even worse.</p><p>When it comes to space, the sliding window is a minimalist. Its space complexity is generally <strong><em>O(1)</em></strong>, meaning it only requires a constant amount of extra memory. This makes it memory-efficient, even when dealing with massive datasets.</p><h4>In Conclusion</h4><p>So, there you have it — a friendly chat about the sliding window pattern. It’s a versatile tool for efficient array and list processing, and it’s surprisingly easy to implement once you get the hang of it. As you gain more coding experience, you’ll become a pro at recognizing when the sliding window can work its magic to streamline your code and find elegant solutions to complex problems. So, next time you’re faced with a tricky programming challenge, remember to slide your way to success with the sliding window pattern!</p><h3>Mind Map</h3><p>Let’s have a look at a visual mind map that summarizes all the things we just discussed. This acts as a cheat sheet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7i6LJXgZad5x7ezFyNuO5Q.png" /><figcaption>sliding Window Pattern Mind Map</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=751cebf936e0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[STL Containers: Vector, Set and Map]]></title>
            <link>https://medium.com/@megha_bh/stl-containers-vector-set-and-map-7a90e0b1e19f?source=rss-49e4df97cd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a90e0b1e19f</guid>
            <category><![CDATA[set]]></category>
            <category><![CDATA[vector]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[stl]]></category>
            <dc:creator><![CDATA[Megha B H]]></dc:creator>
            <pubDate>Fri, 05 Nov 2021 19:46:24 GMT</pubDate>
            <atom:updated>2021-11-05T19:46:24.967Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Master the basics</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BH1iWGWPibgu2fg1Jn3mTA.png" /></figure><p>The blog is about learning the commonly used data structures: <em>Vector, Set, and Map. </em>In my last blog, we discussed <a href="https://medium.com/@megha_bh/power-up-c-with-stl-780cfa42a123">STL</a>.</p><p>The structure of the blog: definition, syntax, some functions, when to use it, and examples.</p><p>Let’s begin with Vector:</p><h3><strong>{ } Vector</strong></h3><p><strong>Definition: </strong>Vectors in C++ are sequence containers representing dynamic arrays. Vectors provide more flexibility to the program as they can adjust their size automatically when an element is inserted or deleted from it.</p><p><strong>Syntax</strong>: <strong>vector &lt;type&gt; variable (elements)</strong></p><p>For example: <em>vector &lt;int&gt; rooms (9);</em></p><p>Let’s break it down:</p><ul><li><strong>type</strong> defines a data type of elements stored in a vector (e.g., &lt;int&gt;, &lt;double&gt; or &lt;string&gt;)</li><li><strong>variable</strong> is a name that you choose for the data</li><li><strong>elements</strong> specify the number of elements for the data and is optional</li></ul><p>It is mandatory to determine the type and variable name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*mKZGaPfgthV3WSiDEwKWaw.png" /></figure><p><strong>Functions</strong>:</p><p><strong>1. assign()</strong> — It assigns a new value to the existing elements of the vector.</p><p><strong>2. push_back()</strong> — It pushes the element from back in the vector.</p><p><strong>3. pop_back()</strong> — It removes elements from the back of the vector.</p><p><strong>4. insert()</strong> — It inserts an element before a specified element in the vector.</p><p><strong>5. erase()</strong> — It is used to remove elements from a specified element or a range in the vector.</p><p><strong>6. swap()</strong> — It is used to swap the contents of two vectors of the same datatype. The sizes of vectors may differ.</p><p><strong>7. clear()</strong> — It is used to remove all the elements from the vector.</p><p><strong>When to use it?</strong></p><p>The scenario that involves:</p><ul><li><em>Constantly changing container:</em> The vectors are preferred when dynamic data is involved where we often add or remove data</li><li><em>No prior knowledge of the maximum size of container: </em>When we don’t know the size of data beforehand or when the data is not established in advance. The size keeps on changing</li></ul><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*Wv9EG388Hx22QMQjn-dw_Q.jpeg" /></figure><h3><strong>{ } Set</strong></h3><p>Sets are associative containers that store unique elements following a specific order.</p><p><strong>Properties</strong>:</p><ul><li>Uniqueness — All elements inside a C++ Set are unique</li><li>Sorted — The elements inside a Set are always in a sorted manner</li><li>Immutable — Any element inside the Set cannot be changed. It can only be inserted or deleted</li><li>Unindexed — The STL Set does not support indexing</li><li>Internal Implementation — The Sets in STL are internally implemented by BSTs (Binary Search Trees)</li></ul><p><strong>Syntax</strong>: <strong>set &lt;type&gt; variable {elements}</strong></p><p>For example: <em>set &lt;int&gt; words {6, 10, 5, 1};</em></p><p>Let’s break it down:</p><ul><li><strong>type</strong> defines a data type of elements stored in a vector (e.g., &lt;int&gt;, &lt;double&gt; or &lt;string&gt;)</li><li><strong>variable</strong> is a name that you choose for the data</li><li><strong>elements</strong> specify the elements(literal values) for the data and is optional</li></ul><p>It is mandatory to determine the type and variable name.</p><p><strong>Functions</strong>:</p><p>The commonly used functions are:</p><p><strong>1. begin( ):</strong> used to return an iterator pointing to the first element of the set container.</p><p><strong>2. end( ):</strong> it returns an iterator pointing to past the last element of the set container</p><p><strong>3. size( ):</strong> used to return the size of the set container or the number of elements in the set container</p><p><strong>4. empty( ):</strong> used to check if the set container is empty or not</p><p><strong>5. insert(x):</strong> inserts a new element in the set container</p><p><strong>6. erase( ):</strong> used to remove elements from a container from the specified position or range</p><p><strong>7. find( x ):</strong> it returns an iterator based on the position of the element if it is found, else return iterator at the end</p><p><strong>When to use it?</strong></p><p>Sets are frequently used containers in competitive programming; whenever there is a need of storing the elements in a sorted manner, we can think of using the sets, but remember that the set does not allow us to store the duplicate values. The value can’t be modified once it is stored.</p><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tu5WPpwvf7S6OI04UkXFMQ.png" /></figure><h3><strong>{ } Map</strong></h3><p>Maps are associative containers that store elements in a mapped fashion. Each element has a key value and a mapped value. No two mapped values can have same key values.</p><p><strong>Syntax</strong>: map&lt;key_type , value_type&gt; map_name;</p><ul><li>The key_type denotes the datatype of the map keys</li><li>The value_type denotes the datatype of the values corresponding to the map keys</li><li>The map_name is the name of the map.</li></ul><p>For example: map&lt;string, int&gt; my_map; <br>We declared a map named my_map. The map will have a string as key datatypes and integer as values datatype.</p><p><strong>Properties</strong>:</p><ul><li>map only stores unique keys, and the keys themselves are in sorted order</li><li>There is only one value for every key</li></ul><p><strong>Functions</strong>:</p><p>Some basic functions associated with Map:</p><p><strong>1. begin(): </strong>it returns an iterator to the first element in the map</p><p><strong>2. end():</strong> it returns an iterator to the theoretical element that follows last element in the map</p><p><strong>3. size():</strong> it returns the number of elements in the map</p><p><strong>4. max_size():</strong> it returns the maximum number of elements that the map can hold</p><p><strong>5. empty():</strong> it returns whether the map is empty</p><p><strong>6. pair insert(keyvalue, mapvalue):</strong> adds a new element to the map</p><p><strong>7. erase(iterator position):</strong> Removes the element at the position pointed by the iterator</p><p><strong>8. erase(const g):</strong> Removes the key-value ‘g’ from the map</p><p><strong>9. clear():</strong> Removes all the elements from the map</p><p><strong>When to use it?<br></strong>Whenever we come across the data that is in the form of key-value pair and we require to perform more search operations on it then it is best to consider the maps. Consider maps when there are constant lookups by key, you search if key/value exists and remove duplicates.</p><p><strong>Example:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*ISihVcykRC-9cyGupheiAw.png" /></figure><h3><strong>{ } General Rules of Thumb</strong></h3><p>There are some general rules of thumb that will guide you through most situations given by <a href="https://embeddedartistry.com/blog/author/phillip/">Phillip Johnston</a></p><ul><li>Use sequential containers when you need to access elements by position</li><li>Use std:vector as your default sequential container, especially as an alternative to built-in arrays</li><li>If the size is known in advance, use std::array instead of a built-in array</li><li>If you add or remove elements frequently at both the front and back of a container, use std::deque</li><li>Use a std::list (not std::deque) if you need to insert/remove elements in the middle of the sequence</li><li>Do not use std::list if you need random access to objects</li><li>Prefer std::vector over std::list if your system uses a cache</li><li>std::string is almost always better than a C-string</li><li>Use associative containers when you need to access elements by key</li><li>For key/value pair, default to std::unordered_map, or if element order matters, std::map</li><li>If you need multiple entries for the same key, use std::unordered_multimap, or if element order matters, std::multimap</li></ul><p>Memory allocation may also be a factor in your decision. Here are the general rules of thumb for how the different sequential containers are storing memory:</p><ul><li>std:vector, std::array, and std::string store memory contiguously and are compatible with C-style APIs</li><li>std::deque allocates memory in chunks</li><li>std::list allocates memory by node</li></ul><h3>{ } Conclusion</h3><p>And there you have it — you now know the basics of vectors, sets and maps in C++. To go on with STL, I would like you to try programs on various websites on coding. This will help you understand the concepts more clearly and improve your coding skills. The more programs you practice the more you get when and why to use C++ STL.</p><p><strong>Thanks! Signing off!</strong></p><p><strong>Megha B. Halasangimath</strong></p><p><a href="https://www.linkedin.com/in/megha-halasangimath/">LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a90e0b1e19f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fear of Success]]></title>
            <link>https://medium.com/@megha_bh/fear-of-success-79f9238957ec?source=rss-49e4df97cd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/79f9238957ec</guid>
            <category><![CDATA[unleash-the-power-within]]></category>
            <category><![CDATA[overcome-fear]]></category>
            <category><![CDATA[setback]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[fear-of-success]]></category>
            <dc:creator><![CDATA[Megha B H]]></dc:creator>
            <pubDate>Mon, 25 Oct 2021 05:16:27 GMT</pubDate>
            <atom:updated>2021-10-25T07:36:46.176Z</atom:updated>
            <content:encoded><![CDATA[<p>Crush the self-imposed barriers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C1cbQKXYODdyjl-dOrMCUA.jpeg" /><figcaption>Take charge of yourself</figcaption></figure><p><em>Do you often struggle to see yourself as truly successful? Do you imagine yourself not handling success responsibly? Do you think there will be more expectations put on you if you get what you want, and you don’t want people demanding more of you? Do you get stressed out thinking you will be seen by more people and you’ll be open to more judgment, criticism?</em></p><p>If you say YES, then you may be the victim of fear of success. Keep reading to learn more about fear of success, how to recognize it and, and how to overcome it.</p><p>Fear of success can also be referred to as <em>“success anxiety”</em> or <em>“success phobia”</em>. It’s probably not success itself that you fear, but the potential price of success. Sometimes, it’s your behind-the-scene manipulations that keep tripping you up on the road to success. Fear of success is an example of <a href="https://medium.com/@megha_bh/limiting-beliefs-e1a5a1e5149b"><strong><em>limiting belief</em></strong></a>.</p><p>We always have setback stages on our journey to the big dream. The most familiar is fear of failure. Often, a person may believe that it is a fear of failure that is obstructing them from trying to accomplish something in their life. Yet, exploration may lead to the discovery that it is a fear of success, which is far less understood compared to the fear of failure. In fear of failure, for instance, you may have a fear: <em>“I would not be able to achieve it” </em>(based on the past happenings in which you have failed) and in fear of success you may have a fear that you will actually accomplish it. For instance, <em>When I buy the dream house, what would I do next? What will I want next? How would I manage that asset? What headaches I will have with a large house? When I will have lots of clients for my new business, I will be always very tired. I will not have time for my family and blah blah.</em></p><p>Say it ain’t so. How can anyone be afraid of success? The result of success is a change which in turn brings an unwelcomed spotlight of attention and many new critics. The more successful you become, the more you get noticed. While getting noticed often brings on more fans, it also brings on more haters.</p><p>Fear of success is not easy to spot, hence most people are not aware of it. They may assert that specific barriers are stopping them on their road to success, but when they analyze these barriers, they might discover that these are mirages and they are crippling themselves as the obstacles are either conquerable or do not exist. One may wonder why a person may fear achieving something that they claim to desire.</p><h3>Why fear success?</h3><ul><li><em>New responsibilities and expectations:</em> People get stressed about how to manage new standards</li><li><em>New attention:</em> Being afraid of what will happen if you were in the spotlight and hate being under the microscope</li><li><em>Resisting accountability from the raised bar:</em> Others start to expect more and hold you accountable for higher levels of performance</li><li><em>New responsibilities and expectations:</em> People get stressed about how to manage new standards</li></ul><h3>What does the fear of success look like?</h3><p>Fearing the result of success can manifest in elusive ways, such as:</p><ul><li><em>Setting low goals/ Lack of goals:</em> You resist being challenged by setting the bar low. People ensure that they never make any real progress toward success by having low expectations</li><li><em>Procrastination:</em> You thwart opportunities. Putting things off until the last possible minute means that people aren’t doing their best or most thoughtful work, which can seriously weaken their chances of succeeding</li><li><em>Perfectionism:</em> You strive for perfection and when you are bound to fall short, that’s reason enough not to progress</li><li><em>Quitting:</em> Just when you’re on the verge of success, you find a reason to give up</li><li><em>Self-destructiveness:</em> Substance abuse and other self-destructive behaviors may serve to wreck success</li></ul><p>Any of these behaviors can keep you from realizing your full potential.</p><h4>You dream of a more fulfilling career. So why don’t you go for it?</h4><h3>Action Points to overcome</h3><p>By exploring our negative beliefs and re-channeling them into beliefs and techniques that boost our strength and self-confidence, we can accomplish all of our goals and more. It takes focus, however, and it takes having the courage to accept responsibility for our place in this life. You can overcome the fear of success. You can start by questioning your fear, improving your self-confidence, and ending self-destructive behaviors.</p><h4>Action 1. Question yourself “What does your version of success look like?</h4><p>Ask yourself the above question and do self-talk, questioning <em>“How will I know if I’m successful? What will I do and how will I act when I’m successful?”</em></p><p>Write down your answers, everything that pops into your head either good or bad. For example, if you think <em>“Success looks like luxury,” </em>write that. Be as specific as possible. For example, instead of writing, <em>“If I have a lot of money, I’ll know I’m successful,”</em> write something like, <em>“I’ll know I’m successful when I have $10 million in savings.”</em></p><h4>Action 2. Ask yourself what exactly you are afraid of when you succeed</h4><p>Define the situation you are worrying about clearly. List out the challenges and downsides that you feel, might arise as a consequence of getting that level of success. Some common blocks are:</p><ul><li><em>After I succeed, I’ll be unable to cope with the pressure</em></li><li><em>Success brings out more responsibility and I’m not capable enough to manage it effectively</em></li><li><em>I will be exposed to more criticism, etc.</em></li></ul><h4>Action 3. Embrace the fear and take control</h4><p>Many of the big setbacks occur when the goal is very very close and you start fearing the success. At this moment, it is important to keep moving by remembering the big vision once again.</p><p>Train yourself with repetitive feeding the mind the statements of truth. Turn the table by changing the list resulting out from <strong>Action 2</strong> into the statements with a new perspective. Re-channel the negative beliefs into the beliefs that boosts your strength and self-confidence.</p><p>For example, <em>“I am not a victim of my fear. I am not afraid of success. I will be successful and I will enjoy it. I am fit enough to deal with any pressure.”</em></p><p>Create a new story by reading out loud these declarative statements every morning regularly. This helps you in reframing your mind by thinking about success that you are appreciative of and in turn diminishing the fear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*sAtyYbtcgVl77mE7HHXB-A.jpeg" /><figcaption>Breath of joy!</figcaption></figure><h3>The Takeaway</h3><p>Fear of success can lurk beneath the surface so it is not easy to spot. However, it’s a genuine fear that can come at great personal cost. If you’re scared of success and its outcomes, the first step is to recognize it. You may choose to combat the fear by self-help or by seeing a therapist. It takes focus, however, and it takes having the courage to accept responsibility for our place in this life.</p><p><em>I highly recommend that you apply the action steps above so that you can manage — even overcome — the fear of success and unleash the power within you.</em></p><p><strong>Tackle your fears head-on and you can start achieving your dreams today!</strong></p><p><em>Did you find the steps listed in this article helpful? Is it now possible for you to re-frame your mind and transform your life?</em></p><p>Drop in the comment section to let me know if this works and if you have any suggestions.</p><p><strong>Thanks! Signing off!</strong></p><p><strong>Megha B. Halasangimath</strong></p><p><a href="https://www.linkedin.com/in/megha-halasangimath/">LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79f9238957ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Limiting Beliefs]]></title>
            <link>https://medium.com/@megha_bh/limiting-beliefs-e1a5a1e5149b?source=rss-49e4df97cd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1a5a1e5149b</guid>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[limiting-beliefs]]></category>
            <category><![CDATA[full-potential]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[self-limiting-belief]]></category>
            <dc:creator><![CDATA[Megha B H]]></dc:creator>
            <pubDate>Sat, 09 Oct 2021 13:42:29 GMT</pubDate>
            <atom:updated>2021-10-09T15:26:52.729Z</atom:updated>
            <content:encoded><![CDATA[<p>Rise above limiting beliefs to discover your full potential</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*Mb4GZs_PcO695fR-RzCRTg.png" /><figcaption>Photo from <a href="http://www.carolefossey.com/">http://www.carolefossey.com/</a></figcaption></figure><p><em>Are you constantly wondering why are you not where you want to be in your life? Like many, you are also struggling with limiting beliefs. Once you identify those limiting beliefs, you can thrash them and tap the unlimited potential within you.</em></p><p>Many of us constantly strive to grow in our lives either professionally or personally. We establish new objectives, new determinations, and roadmaps to achieve the things we want. We begin with a gush of willpower but as time passes, we become complacent and our goals lose their luster.<br><em>Recall how many goals you have set but were never able to achieve?</em><br>Of course, each one of us has so many excuses to tell ourselves that is restricting you from being who you want to be or where you want to be?</p><blockquote><strong>Tony Robbins says,</strong><br>“The only thing that’s keeping you from getting what you want is the story you keep telling yourself.”</blockquote><p>Broaden your mind and you will learn that some hidden beliefs are holding you from being successful. These are nothing but limiting beliefs.</p><p>According to Tony Robbin, <em>a belief is an idea that a person holds as being true. Beliefs create the maps that guide us toward our goals and give us the power to take action. The challenge is that most of our beliefs are generalizations about our past, based on our interpretations of painful and pleasurable experiences.</em></p><blockquote>Limiting beliefs are exactly what they sound like. My definition for limiting beliefs is: “beliefs that limit the use of your unlimited potential to achieve what you believe is possible”.</blockquote><p>No matter what your limiting beliefs are, they restrict the scope of how you see the world. Limiting beliefs restrict you from seeing all that there is to the world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*zGNPOeqlNcQioxzFpZTdwA.png" /><figcaption>Photo from <a href="https://www.roamatdawn.com/blog/2013/10/10/secret-gardens-rome-travel">https://www.roamatdawn.com/blog/2013/10/10/secret-gardens-rome-travel</a></figcaption></figure><p>Imagine there’s a peephole in the wall and you are allowed to see the outside world from that peephole. I say, the scope is limited and you are unable to see all that is there to see. Right?</p><p>If you were to look at life through that peephole 24/7, how much of life would you miss?</p><p>Exactly the Limiting beliefs act like that peephole. You may now be wondering <em>why our belief system works against us?</em></p><h3>The first thing to understand is to know the <strong>origin</strong> of our belief system.</h3><p>Many limiting beliefs are developed in childhood when you aren’t always able to process what happens to you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*-KEELU3asnRRI8MO-J5tLA.jpeg" /><figcaption>Photo from <a href="http://www.tonyrobbins.com/">www.tonyrobbins.com</a>: Places from where beliefs come from</figcaption></figure><p>The impact of these is stored in our mind subconsciously comforting our mind to avoid any negative emotions like frustration, anxiety, anger, sadness. Whenever you face similar episodes where you might have suffered in the past then the stored belief system gets triggered. That means you subconsciously block the current happenings by changing your behavior resulting in negative outcomes like <em>procrastination, traditionalism, overthinking, anxiety, impostor syndrome, so on.</em> These are invisible feedback loops created by us that in turn act as false barriers for ourselves preventing us from fulfilling our highest potential.</p><h3>Overcoming limiting beliefs is easier than you think</h3><p>The way that you clear limiting beliefs are by recognizing them and letting go of them. <strong>Limiting beliefs are often so much a part of us that we don’t even realize they’re there. So, give yourself a lot of time to ponder and do the following exercise (given by Dr. Tomi White Bryan)</strong></p><h4><strong>Step 1: </strong>Pick a topic you want to clear limiting beliefs around</h4><p>Write on a piece of paper: “I want to clear limiting beliefs around ………”. The topic can be anything, maybe a job, finances, relationships, health, etc. I’m going to use my example, <em>“Career Transition”</em>.</p><h4>Step 2: List out all limiting beliefs you have about that topic</h4><p>Now make a list of all beliefs you have around that topic. With my example of career transition, I came up with a list of limiting beliefs running through my head easily:</p><ul><li><em>I’m too old to be seen as valuable</em></li><li><em>I’m too young to be taken seriously</em></li><li><em>My experience is going to scare off employers</em></li><li><em>I’m too old to pursue my dream career</em></li><li><em>I’ll never get a job with my experience</em></li><li><em>Women aren’t taken seriously in the tech world</em></li><li><em>My friends have it all figured out</em></li><li><em>Taking a sabbatical is frowned upon</em></li><li><em>I’ll never find a job that gives me flexibility as a mom</em></li><li><em>Taking a gap year will ruin my chances of pursuing a career that I want</em></li></ul><p>(<a href="https://drive.google.com/file/d/1LIsKbt2REIzoii0udLS-LyALfYAYYYEe/view?usp=drivesdk">Click to check the examples that help you in identifying limiting beliefs</a>)</p><h4>Step 3: Thank these beliefs for how they have protected you</h4><p>It may sound senseless to thank the beliefs which limited you, Right? However, it’s important to respect these beliefs. They have come a long way with us, they do have a valid purpose protecting us from getting us burned again from the negative traumatic vibrations.</p><blockquote><strong>In </strong><a href="https://takecontroladhd.com/podcast/286"><strong>Michelle Chalfant</strong></a><strong> for a Podcast says,</strong><br>“Thank the belief for being there to protect you, but tell it to leave… because you’ve got this!”</blockquote><p>Thank them and move on saying you are big enough now to move past it and make the right decision at this moment without that running your thoughts.</p><h4>Step 4: Forgive yourself &amp; others for all the different beliefs you have developed</h4><p>Now, after you thanked your companions (aka beliefs), you are going to give yourself permission to forgive and work past these beliefs. Forgive yourself for holding onto these beliefs longer than they were supposed to serve you. Permit yourself to move forward. Tell yourself, it’s okay, I am safe and secure and I am ready to let go of my limiting beliefs. It’s going to be okay.</p><p>You might even feel energetic. You might be feeling a few emotions while actively going through this exercise. That’s okay.</p><p><strong><em>You can repeat this process with any area in your life that you have limiting beliefs.</em></strong></p><p>As you undergo the process, you will begin to see different possibilities accessible to you, and you will be ready for any opportunity life presents to you.</p><p><em>Note: As limiting beliefs is habitual, so is to release them. It doesn’t happen overnight and you wake up the next day believing you’re rich. The process is slow. Over time with consistent practice you will realize that amazing opportunities present themselves before you, when you take action you feel empowered that nothing is impossible!</em></p><blockquote><strong>I suggest you burn (literally burn) the paper in which you wrote all the beliefs. This simple act will give an instant relief as watching the negative beliefs burn right in front of you will often help detach yourself from those beliefs (Cognitive Behavior Therapy). Try it out for yourself!</strong></blockquote><p><em>Now, it’s time to give yourself the gift of releasing your limiting beliefs. They are relatives that have overstayed their welcome. Help them pack their bags and leave.</em></p><blockquote><strong>Daniel DiPiazza says,</strong><br>“Changing what you believe about yourself is the precursor to every other change you seek”</blockquote><p><em>Did you find the steps listed in this article helpful? Is it now possible for you to re-program your mind and change into an amazing life that you always craved for?</em></p><p>Drop in the comment section to let me know if this works and if you have any suggestions.</p><p><strong>Thanks! Signing off!</strong></p><p><strong>Megha B. Halasangimath</strong></p><p><a href="https://www.linkedin.com/in/megha-halasangimath/">LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1a5a1e5149b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Power up C++ with STL]]></title>
            <link>https://medium.com/@megha_bh/power-up-c-with-stl-780cfa42a123?source=rss-49e4df97cd59------2</link>
            <guid isPermaLink="false">https://medium.com/p/780cfa42a123</guid>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[stl]]></category>
            <category><![CDATA[standard-library]]></category>
            <category><![CDATA[coders]]></category>
            <category><![CDATA[cpplus]]></category>
            <dc:creator><![CDATA[Megha B H]]></dc:creator>
            <pubDate>Thu, 07 Oct 2021 11:57:16 GMT</pubDate>
            <atom:updated>2021-11-05T19:50:05.025Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Become a better coder with STL</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gr3_sf_TPgkW6Pc34NkWUw.jpeg" /></figure><p>Many programmers eagerly learn C++ as a language but keep its standard library, the STL, in the last place of learning. Using C++ without greater functionalities means dropping half its strength.</p><p>If you are using C++ as your main programming language to solve problems or if you are not a C++ programmer earlier but want to become one because of the great functionality of its libraries, then it is a must for you to know about C++ STLs.<br>Irrespective of where you’re coming from, this article can help. Here, we will analyze a great tool- <strong>Standard Template Library (STL)</strong> — that sometimes, can save you a lot of time in programming.</p><h3>Let’s begin with defining STL</h3><p>STL in C++ stands for <strong>S</strong>tandard <strong>T</strong>emplate <strong>L</strong>ibrary. It’s a sophisticated and powerful library of <em>template classes</em> and <em>template functions</em> that implement many common <em>data structures</em> and <em>algorithms</em> and forms part of the C++ Standard Library.</p><p>It is recommended to have a working knowledge of <a href="https://www.geeksforgeeks.org/templates-cpp/"><em>templates</em></a> before going deeper into STL, hence this article is not for C++ beginners.</p><p>One might ask, <strong>why should a C++ programmer be interested in the STL?</strong></p><p>It is because STL helps developers to code <em>quickly</em> and <em>efficiently</em>. Quickly in the sense, as most algorithms and data structures are already been implemented in STL, so we just need to use them as required.</p><p>Let’s take an example. Let’s say there’s a question that can be easily solved using binary search. But implementing this algorithm itself takes some time, right? But in C++ you can easily code a problem using binary search by just including some header files and that’s it, you are done!</p><p>The use of STL can dramatically change your programming style, allowing your code to be more <em>reusable, solid, and robust increasing productivity</em>, by making the <em>developer focus on the main issue</em>. Programming is a way of life and you can make it easier by taking advantage of STL. STL is also <em>extensible, letting you add customized containers and algorithms.</em></p><h3>STL Components</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*Krp2xz3hliT3PZk9aNe8sA.png" /><figcaption>Four kinds of STL components</figcaption></figure><p><em>The lucid explanation for STL is to begin from its containers.</em></p><h3>Containers</h3><p>You choose containers when you want to operate with several elements. Right? In native C (not C++) there was only one type of container: the <em>array</em>.</p><p>The problem is not that arrays are limited (though, for example, it’s impossible to determine the size of an array at runtime). Rather, the main problem is that many programs require a container with greater functionality.</p><p>Let’s say, one or more functionalities are needed for the below operations</p><ol><li><em>Add some elements to a container</em></li><li><em>Remove an element from a container</em></li><li><em>Determine whether an element is present in the container</em></li><li><em>Return count of distinct elements in a container</em></li><li><em>Iterate through a container and get a list of added elements in some order</em></li></ol><p>Yes, of course, you might think that one can implement this functionality with an array. But the <em>trivial implementation would be very inefficient. You can create the tree- of hash- structure to solve it in a faster way, but think a bit: does the implementation of such a container depend on elements we are going to store? Do we have to re-implement the module to make it functional, for example, for points on a plane but not strings?</em></p><p>If not, we can develop the interface for such a container once, and then use it everywhere for data of any type. That, in short, is the idea of STL containers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*6EagSKBq3icqbPk3OT7AiA.png" /></figure><h4><em>There are four types of containers:</em></h4><ol><li><strong>Sequence Containers </strong>are<strong> </strong>used for data structures that store objects of the same type linearly.</li><li><strong>Container Adaptors</strong> are not full container classes on their own, but wrappers around other container types (such as a vector, deque, or list). These container adapters encapsulate the underlying container type and limit the user interfaces accordingly.</li><li><strong>Associative Containers </strong>are designed in such a way that they can support direct access to elements using keys. They are not sequential. The associative containers are based on tree structures</li><li><strong>Unordered Associative </strong>are similar to associative containers but unordered associative containers are based on another form of a data structure called a hash table.</li></ol><h3>3 things to remember for all the programs using STL</h3><ol><li><strong>#include the appropriate standard headers:</strong> put the name of the container in the title of the standard header and no extension is required. For example, if you are going to use vector, just add the following line at the beginning of your program: <br><em> #include &lt;vector&gt;</em></li><li><strong>Define in special namespace:</strong> You need to define container types (and algorithms, functors, and all STL as well) in a special namespace known as “std” as these are not defined in the global namespace. Insert the below line before the code begins and after the header file inclusion:<br><em>using namespace std;</em></li><li><strong>Type of a container is the template parameter:</strong> Template parameters are specified with the ‘&lt;’/’&gt;’ “brackets” in code. For example:<br><em>vector &lt; int &gt; N; //for storing integer values</em><br>When using nested structures, make sure that the “brackets” are not directly next to one another — insert a blank between them.<br><em>vector &lt; vector &lt; int &gt; &gt; </em><strong><em>CorrectDefinition;<br></em></strong><em>vector &lt; vector &lt; int &gt;&gt;</em> <strong>WrongDefinition;</strong> <br><em>// Wrong: compiler may be confused by ‘operator &gt;&gt;’</em></li></ol><h3>Conclusion</h3><p>This sums up a brief introduction to Standard Template Library. That’s all you need to get started. Over time you’ll learn the power of using STL effectively. I plan on digging deep and my next blog will focus on <a href="https://medium.com/@megha_bh/stl-containers-vector-set-and-map-7a90e0b1e19f"><strong>vectors, sets, and maps</strong></a><strong> </strong>with some hands-on<strong>.</strong> So, stay connected because you are going to learn many things in the simplest way possible, and as the cherry on top, find an <strong>STL cheat sheet </strong>at the end.</p><p><em>Lastly, never stop exploring. Learning to use STL is no small task. The C++ standard has a wide range of concepts and methodologies that can be derived from the library. No article can replace the knowledge of a few good books and a lot of implementations.</em></p><h4>Drop me a comment if you have any queries or if you want me to write about anything else for you…</h4><p>Thanks! Signing off!<br>Megha B. Halasangimath</p><p><a href="https://www.linkedin.com/in/megha-halasangimath/"><strong>LinkedIn</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=780cfa42a123" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>