<?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 Njan.Codes on Medium]]></title>
        <description><![CDATA[Stories by Njan.Codes on Medium]]></description>
        <link>https://medium.com/@njansmailbox?source=rss-6e6e37f388c8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*9i6AXCH_Z50vdQT3</url>
            <title>Stories by Njan.Codes on Medium</title>
            <link>https://medium.com/@njansmailbox?source=rss-6e6e37f388c8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:48:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@njansmailbox/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[Backtracking or]]></title>
            <link>https://medium.com/@njansmailbox/backtracking-or-6b27e08fbea9?source=rss-6e6e37f388c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b27e08fbea9</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[devlog]]></category>
            <category><![CDATA[stack]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[backtracking]]></category>
            <dc:creator><![CDATA[Njan.Codes]]></dc:creator>
            <pubDate>Wed, 23 Apr 2025 16:44:31 GMT</pubDate>
            <atom:updated>2025-04-23T16:44:31.912Z</atom:updated>
            <content:encoded><![CDATA[<h3>Backtracking or Stack ????</h3><p>Yeah its been a while. I have end semester exams, so focusing on that.</p><p>Today, however I got bored of studying for the exam and thought about doing some leetcode.</p><p>I follow the roadmap set out by neetcode.io. I am currently in the stack section. The problem you might ask ?</p><h3>Generate Parentheses ()()()..</h3><p>The problem goes like this, you are given a number which represents the pair of parentheses. Using this generate all the possible combinations of valid parentheses (Valid as in, open parentheses should come before the closed parentheses). For example,</p><blockquote>Input = 1 , Output= ()</blockquote><blockquote>Input = 3, Output= ()(()) (())() ()()() (()()) ((()))</blockquote><p>This was an interesting problem, cause I didn’t get how a stack would be used here and, under the topics section in leetcode, it is written backtracking, dynamic programming and string. There was no relation to stack. I completely ditched the idea of solving it with a stack.</p><p>So, with the problem understood and the blank is zero, we move on to the solution.</p><h3>🧠 My Genius Solution</h3><p>First order of business, I need to figure out how this question is related to backtracking. My experience in backtracking is not great. My brain goes in smoke when I start thinking about recursive functions.</p><p>However, I had 2 or 3 questions which related to backtracking that I had solved. All of them consisted a tree. What is a tree you ask ??</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*lT00lX2DB4U8MwR5848jzA.jpeg" /><figcaption>This is a tree in computer science</figcaption></figure><p>So, with this idea in mind, I was trying to fit the problem to a tree and it clicked. I have a starting open parentheses, then I add an open parentheses and in another state a closing parentheses. Then the newly formed parentheseses (Is that the plural form of parentheses ??? ) will be going through that again, adding more and more open or closed parentheses. After a certain amount of iterations (I will discuss this arbitrary amount), it will output all the possible combinations. You can visualize it by the below chart from leetcode discussions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*TE734wcIWtW1-09eaAI1hA.png" /><figcaption>This image is given by <a href="https://leetcode.com/u/tejavenkatlanka/">tejavenkat lanka</a></figcaption></figure><p>Some of the nodes have been deleted, that is because they are not valid. However, I still compute those nodes. After creating the whole tree, I check for nodes which are at the bottom (and has no nodes connected underneath to it) and check if they are valid. If they are valid, then output it, else discard it.</p><p>Here, you might be asking how many iterations have to be made to reach that tree. This number isn’t arbitrary but a calculated number. The number of iterations to take is 2 times the input given. I reached that conclusion by drawing the tree myself for other inputs. The number of iterations was always double the input.</p><p>Putting all that information as code in leetcode, I solved the problem. Whooorayyyyyy 🎉🎉🎉🎉🎉🎉</p><p>This was a a fun problem. However, I still wonder why this question was under the stack section, that is probably neetcode’s mistake.</p><blockquote>Caution: This solution is not efficient but gets the job done. For more efficient solution watch this <a href="https://youtu.be/s9fokUqJ76A?feature=shared">video</a>.</blockquote><p>I have stopped my development on the extension due to exams. If I do have any updates I will blog about it. Don’t worry I haven’t abandoned it.</p><p>Thank you and that’s all is there to it for today.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b27e08fbea9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Read The Fucking Manual]]></title>
            <link>https://medium.com/@njansmailbox/read-the-fucking-manual-236b39948faa?source=rss-6e6e37f388c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/236b39948faa</guid>
            <category><![CDATA[rtfm]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[extension]]></category>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[manuals]]></category>
            <dc:creator><![CDATA[Njan.Codes]]></dc:creator>
            <pubDate>Tue, 15 Apr 2025 16:24:51 GMT</pubDate>
            <atom:updated>2025-04-15T16:28:51.441Z</atom:updated>
            <content:encoded><![CDATA[<p>The title says it all for this development log.</p><h3>The Plan</h3><p>It is to create a MVP (Minimum Viable Product — fancy word for, the type of product that has the core functionality) by next month, i.e. May 13th.</p><p>To check out the idea go to my previous blog, <a href="https://medium.com/@njansmailbox/a-little-idea-bf73d39d493d">A little ideas…</a></p><p>Today, I worked on entering the details by the click of a button which would be showcased when you click the extension in the toolbar in your browser.</p><p>From the previous devlog, I had encountered the problem of not getting logs of my extension, this has been solved (Yayyy!!!).</p><h3>How did I solve this ?</h3><p>Using the age old technique of RTFM (Read the Fucking Manual). In my case, I read the documentation for creating an extension in firefox. Previously, I just winged it by guessing stuff, which made the most sense to me and was the easiest to implement it.</p><p>“Reading is boring” I thought while I waste 15 minutes of checking whether the extension is working or not. I, then started reading the documentation from top to bottom, there and behold the answer to my question. The console for the extension is situated at the place where I load the extension to firefox.</p><p>Other than the fact that I didn’t read the documentation for the extension, another mistake I did, which comes from the article <a href="https://endler.dev/2025/best-programmers/"><em>Best Programmers I Know</em></a><em>, </em>is to not guess the solution whenever you encounter a problem.</p><p>Best programmers don’t guess what happens because this can result into two cases:</p><ol><li>Best Case — You are wrong and this lead to bugs</li><li>Worst Case — You are correct and you’ll make a habit of guessing which eventually leads to you second guessing yourself.</li></ol><p>Of course these two are bad, so you might be asking what to do, to replace the habit of guessing.</p><p>Read The Fucking Manual (RTFM), Ask The Fucking Questions (ATFM), use a debugger, be thorough. Do anything to get to your answer.</p><p>These pieces of knowledge are from the article I have linked above.</p><h3>That’s done, what’s next ?</h3><p>Well, I have collected the common information asked in both the websites and using that I created a basic UI in figma.</p><figure><img alt="Screenshot of the UI I created in figma." src="https://cdn-images-1.medium.com/max/407/1*_B0hFhl0RdXb8HzUmzrM1w.png" /><figcaption>The UI for the page (Subject to change) .</figcaption></figure><p>There is selection tab which allows the user to include all the hackathon websites that are required by the user. This allows multiple input fields to supply data for different websites. The labels in our UI, is the common elements found in both the websites.</p><p>The UI is for a page that will be shown when the user desires to enter the details of the hackathon. It is in it’s infancy right now, because I am not a front-end developer and haven’t decided on a logo to put on the website.</p><p>Right now, I am not focused on the logos or whether I am a good frontend dev. I am focused on the coding side of it, which now means implementing the UI I made in figma and connect it to the extension to use the data submitted by the user.</p><p>Thank you and that’s all is there to it for today.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=236b39948faa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A little idea..]]></title>
            <link>https://medium.com/@njansmailbox/a-little-idea-bf73d39d493d?source=rss-6e6e37f388c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf73d39d493d</guid>
            <category><![CDATA[web-browser]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[firefox]]></category>
            <category><![CDATA[codi̇ng]]></category>
            <category><![CDATA[browser-extension]]></category>
            <dc:creator><![CDATA[Njan.Codes]]></dc:creator>
            <pubDate>Sun, 13 Apr 2025 15:53:11 GMT</pubDate>
            <atom:updated>2025-04-15T15:46:41.264Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a series that logs my development process of a little idea I have. The idea is as follows,</p><blockquote>To create a browser extension in firefox to auto-fill registrations. These registrations are for publishing hackathon details in websites such as <a href="https://devfolio.co/discover">devfolio</a> , <a href="https://devpost.com/">devpost</a>, etc.</blockquote><h3>My Plan</h3><p>It is to create a MVP (Minimum Viable Product — fancy word for, the type of product that has the core functionality) by next month, i.e. May 13th.</p><p>Today, I worked on the product to just fill the name section in both the websites. That sounds easy, but wasn’t.</p><p>I couldn’t just log the values and functions in the console for some reason (Have to figure that one out). This made me uncertain whether what I wrote in the program is working or not. Yes, I log most of my values to the console while coding and yess I am working on trusting what I write and not spend 30 minutes to printout every value.</p><p>I solved this by giving the page a border of yellow. This signaled me that the extension is loaded into the website.</p><p>The next problem was, whenever I changed the value in the input element in the devpost website, it didn’t change it’s value in the input entry. This was concerning because I have been manipulating values of inputs for 1 or 2 years.</p><p>This utterly baffled me because it just didn’t make any sense. Like the thing of modifying the value of input element should change whatever is written in that element.</p><p>Was all of it a lie ? Were there times where changing a value of the input doesn’t necessarily modify what’s written in the input element ?? These were concerns that were going through my mind (Yes, I over-think, now stop judging me).</p><p>So, I checked if any other field in the webpage changed its data based on the value’s value. Yup it didddd. This made me more worried, because why wasn’t the input field for name not working but the rest of them did. This made absolutely made no sense to me. Then I found it,</p><p>I ran all the code to modify the input element by listening to the event DOMContentLoaded (Which means, fire an event when the DOM is loaded). After this error, I removed the listener who has been listening to the DOMContentLoaded event and then I used buttons to run the code.</p><p>I got that idea from the tutorial I was following in the <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_second_WebExtension">Mozilla Docs</a> (Great resource, if you are a web developer). In that tutorial, there were buttons to run the code.</p><p>I applied listener to buttons being clicked. Then I coded up the same logic for entering the details in the form and I clicked the button I appended to the webpage and..</p><p>Voila!!!</p><p>It worked, the input section for name is being filled by my desired value in code. I was happy about it, but was confused as well, as I didn’t know why the DOMContentLoaded event didn’t work. My assumptions are that the DOMContentLoaded event was fired but the input element was still not created and thus produced an error that I couldn’t see (Yes I don’t handle errors, like I said STOP JUDGING ME!!!).</p><p>This is all that has what happened today regarding the browser extension development. For tomorrow, I want to achieve modifying all the attributes for basic details based on a JSON file.</p><p>Thank you and that’s all is there to it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf73d39d493d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 6 — Pride]]></title>
            <link>https://medium.com/@njansmailbox/day-6-pride-185bcf7d3187?source=rss-6e6e37f388c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/185bcf7d3187</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[pride]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[diary]]></category>
            <category><![CDATA[cool]]></category>
            <dc:creator><![CDATA[Njan.Codes]]></dc:creator>
            <pubDate>Sat, 15 Mar 2025 16:04:22 GMT</pubDate>
            <atom:updated>2025-03-15T16:04:22.935Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 6 — Pride</h3><p>Today, an old and rare feeling arose — it was pride. The pride I felt in myself. This was because I was the only person able to solve a test given by our placement officer. This feeling gave me proof that what I do every day is worth it and that I am making the right moves. Daily solving of LeetCode questions, working on some project every week, reading books or articles, and watching videos related to computer science — all of this helped me today. With this newly collected proof, I am going to grow even more and collect more evidence that I am good in this field.</p><p>Saying this, and once I reached home, I started slacking — watching YouTube videos for four hours straight. The number of videos I skipped after watching them for a few minutes was plenty. The constant choosing of videos to watch eventually bored me. Then came a surge of productivity that I utilized to solve today’s LeetCode and work on my website. The website uses an API, and I was learning how to use it.</p><p>All in all, today was a good, prideful day. Nothing more cause I am sleepy as hell. Bye</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=185bcf7d3187" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 5 — Nerd Out]]></title>
            <link>https://medium.com/@njansmailbox/day-5-nerd-out-a7b10257c3fd?source=rss-6e6e37f388c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7b10257c3fd</guid>
            <category><![CDATA[nerds]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[diary]]></category>
            <category><![CDATA[nerding-out]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <dc:creator><![CDATA[Njan.Codes]]></dc:creator>
            <pubDate>Fri, 14 Mar 2025 17:14:44 GMT</pubDate>
            <atom:updated>2025-03-14T17:14:44.209Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 5 — Nerd Out to Everyone</h3><p>Today was a refreshing day, because I was told that, to get a job in the tech field, I need to bring out my nerdiness to the world. You might be thinking that bringing out your nerdiness means building more projects. That’s not it; it means expressing your nerdiness to everyone by talking about it, embracing it, exploring it, and connecting with like-minded people who share the same level of nerdiness. This is what’s commonly known as networking.</p><p>For me, though, networking always sounded overly “professional”. I didn’t even know what it was about. Like, I get that you make connections, but friendships solely formed for job opportunities don’t feel genuine with me. I learned this from a <a href="https://youtu.be/2PiM2e4RtTg?si=3J-HB1RgSev5h6pl">video</a>.</p><p>This gave me a sense of relief, that, nerding out to people is a way to get a job. Earning their trust by simply nerding out is a great way to get a job.</p><p>From now on, I am going to seek out and communicate more to people who are like-minded. This will also help me learn faster. How ? There is something called peer pressure. The peer pressure from everyone recommending new tools, or programming languages will help me focus more on learning.</p><p>Another great piece of news: I am going to work on a website I have in mind for next week. I do have tests coming up next week, but I will make significant progress in myproject.</p><p>I haven’t made progress on any of the topics I usually cover daily</p><h3>Conclusion</h3><p>Today was a day of change. It was about a new perspective on the ways I could network as a software engineer. It also set the stage for my project next week</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7b10257c3fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 4—Nothing]]></title>
            <link>https://medium.com/@njansmailbox/day-4-nothing-ba503c4cd8e7?source=rss-6e6e37f388c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba503c4cd8e7</guid>
            <category><![CDATA[nothingness]]></category>
            <category><![CDATA[nothing-phone-1]]></category>
            <category><![CDATA[nothing-burger]]></category>
            <category><![CDATA[nothing-3-phone]]></category>
            <category><![CDATA[nothing]]></category>
            <dc:creator><![CDATA[Njan.Codes]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 16:20:35 GMT</pubDate>
            <atom:updated>2025-03-13T16:20:35.748Z</atom:updated>
            <content:encoded><![CDATA[<p>Today was a good day. I went out to buy electronic components for a project I am going to embark on. The whole trip drained me mentally, making it real hard to focus on solving today’s leetcode. I didn’t even work on my website. My brain just wasn’t in the right place.</p><p>It wasn’t about waiting for motivation — I just couldn’t think clearly. The trip was exhausting, to be honest. I was also setting up the electronic components (If you are wondering, it’s just a few heart rate sensors and ESP32). My project for college needs these. So, my time went to that.</p><h4>Current Goal: To earn ₹1 from a product I’ve created.</h4><p>That is still my goal, but this will change by next week.</p><p>What is the change you ask</p><p>Well, I was browsing through youtube for videos to watch. Then I came across a video from <a href="https://www.youtube.com/@betterideas">Better Ideas</a>. The video is<a href="https://youtu.be/cAdcaLIALiU?si=Uj6G3LGVmWf3B--D"> 23 Habits that will ruin your life</a>.</p><h3>#14 Rule: Focus on Getting Things Instead of Being Somebody.</h3><p>This made me think. Instead of chasing behind the money, I want to be someone. I think that is more motivating than going after stuff. This is my opinion, by the way. I want to gather all the virtue of a person I am aiming to be. So, for next week the new goal will be:</p><p>I want to be someone who has a lot of projects in his hands. I want to be someone who can create a website effortlessly. Just ask this guy and he will build it for you. I believe, that is who I want to be.</p><blockquote><strong>Someone who creates websites effortlessly.</strong></blockquote><p>This would be my goal for next week.</p><p>There isn’t much to read anything today, because I haven’t done much today.</p><p>Peace!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba503c4cd8e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 3 — Lose The Negativity]]></title>
            <link>https://medium.com/@njansmailbox/day-3-lose-the-negativity-b6ff7de0cafc?source=rss-6e6e37f388c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6ff7de0cafc</guid>
            <category><![CDATA[pointers]]></category>
            <category><![CDATA[demotivation]]></category>
            <category><![CDATA[diary-entry]]></category>
            <category><![CDATA[positivity]]></category>
            <category><![CDATA[negativity]]></category>
            <dc:creator><![CDATA[Njan.Codes]]></dc:creator>
            <pubDate>Wed, 12 Mar 2025 16:06:15 GMT</pubDate>
            <atom:updated>2025-03-12T16:06:15.794Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 3 — Lose The Negativity</h3><p>One of the teachers from our placement institution shared an interesting thought today at college,</p><blockquote>If I were an employer, I wouldn’t employ any of you.</blockquote><p>Then he went on to talk about the problems we had, one of which was we didn’t grasp the seriousness of the situation or at least, that’s what I think he meant. I don’t know, because I was too focused on that quote of his. It was disheartening, to say the least, to hear the problems we have without being given a solution or even a way to find one. This is done by many adults I have encountered, to be given a problem without a solution was frustrating.</p><p>This made me realize that <strong>whenever I point out someone’s problem, I should either offer a solution (If I have one) or be willing to find one.</strong></p><p>That is all.</p><blockquote><strong>Back to our scheduled programming (pun intended) ,</strong></blockquote><h3>Current Goal: To earn ₹1 from a product I’ve created.</h3><h4>What I Did Today ?</h4><p>Nothing remotely related to the goal.</p><h4>What I Learned Today ?</h4><p>You could say I learned about two pointers from today’s leetcode. Why beat myself right ? Yeah I learned about two pointers for today.</p><p>How it works is two pointers are made to store the elements of an array or the indicies of an array. Then these two pointers are used to compare the values to get a certain output. That is the jist of it.</p><p>They are called two pointers because they will be pointing to a value in memory (array).</p><figure><img alt="It is an image showing an example of two pointers for an array" src="https://cdn-images-1.medium.com/max/1024/0*TZtloXJx6zX7xs4M" /></figure><p>This is a representation of it. As you can see, the left and right are pointing to the elements in the array. Thus, 2 pointers.</p><h4>LeetCode Progress</h4><p>Today, I completed 2 leetcode problems, Yayyyyyy!!!!!!!!!</p><p>Completing 2 leetcode was fun. Granted one was easy but I completed it nonetheless. The first leetcode problem is ,</p><p><strong>Problem Summary #1</strong></p><p>Check if the sentence is palindrome. The sentence is a palindrome, if, after removing all the non-alphanumeric characters and converting all uppercase alphabets to lowercase, it reads the same forward and backward.</p><p><strong>Initial Thought Process</strong></p><p>This was easy, and the solution for this is to use two pointers (obviously).</p><p>First we remove all the non alphanumeric characters and convert all uppercase letters to lowercase. This allows for proper checking.</p><p>Then create two pointers one at the beginning and the other at the end of the array. Then, check if elements at both the places are same. If they are same for the whole sentence, then it is a palindrome. If any point it doesn’t become equal, then it isn’t a palindrome.</p><p>Somehow, this worked first try. Whooooop Whooooooop !!!!!!!!!!!!!!!!!!</p><p>Let’s move on to the next one,</p><p><strong>Problem Summary #2</strong></p><p>In this, we are given a sorted (ascending order) array of integers and then asked to find the 2 numbers that when added together gets a target number. The test cases here will only have one solution.</p><p><strong>Initial Thought Process</strong></p><p>You could say I cheated in this one, because I did hear about the solution (not code, just the explanation) of this problem, while I was learning about two pointers. I didn’t consider it as cheating because I learnt something new from it and also I implemented the explanation into code for the solution.</p><p>The initial thoughts about it would be the obvious, checking every element with every other element, this would however have a worst case scenario of O(n²). That isn’t ideal.</p><p>The actual way to solve it is, can you guess it ??</p><p>Yes, you guessed correctly, it is two pointers.</p><p>In this case, however, there is change in when we update the pointers.</p><p>The two pointers are created. The array is sorted, which means the left pointer is pointing at the smallest value in the array and the right pointer is pointing at the largest value in the array.</p><p>Now , if we sum those two and compare it to the target, 3 things can happen:</p><blockquote><strong>Sum &gt; Target</strong></blockquote><p>This means the largest value is too large for the addition to reach the target. Thus, the right pointer is decreased by 1 to point at the second largest value. After the change, they are summed and compared.</p><blockquote><strong>Sum &lt; Target</strong></blockquote><p>This means the smallest value is too small for the addition to reach the target. Thus, the left pointer is increased by 1 to point at the second smallest value. Same, after the change has made, they are compared.</p><blockquote><strong>Sum == Target</strong></blockquote><p>This obviously tells us that this is the answer.</p><p>That is how we solve this problem.</p><h3>Conclusion</h3><p>The day may have started with all the demotivation and problem with no solutions. I still persevered and managed to solve my problems by coming up with solutions and be patient. What all I have to say to this day is, think for a second or two, before you accept some type of criticism.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6ff7de0cafc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 2 — Learning Through Constraints]]></title>
            <link>https://medium.com/@njansmailbox/day-2-learning-through-constraints-10a54b92a4d8?source=rss-6e6e37f388c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/10a54b92a4d8</guid>
            <category><![CDATA[optimization-algorithms]]></category>
            <category><![CDATA[debugging-javascript]]></category>
            <category><![CDATA[diary-writing]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[leetcode-medium]]></category>
            <dc:creator><![CDATA[Njan.Codes]]></dc:creator>
            <pubDate>Tue, 11 Mar 2025 13:37:08 GMT</pubDate>
            <atom:updated>2025-03-12T11:37:22.637Z</atom:updated>
            <content:encoded><![CDATA[<h3>Current Goal: To earn <strong>₹1</strong> from a product I’ve created.</h3><h4>Tasks That Brought Me Closer to My Goal</h4><ul><li>Today, I didn’t get to work directly on my goal due to a college project. While this might seem like a setback, I still gained valuable skills that will help me in the long run.</li></ul><h4>🔥 <strong>What I Learned Today</strong></h4><ul><li>The project had a delay, which made me realize the importance of planning better.</li><li>I learned how to stay calm and work efficiently under time constraints.</li><li>I used ChatGPT and other online resources to gather information about the hardware needed for my project.</li><li>This helped me understand how to break down a research problem and find relevant data quickly.</li><li>Worked on improving my <strong>oral presentation skills</strong> and making my slides more structured and engaging.</li></ul><h4>🧠 <strong>LeetCode Progress</strong></h4><h4>Problem Summary</h4><ul><li>Given an <strong>unordered array</strong> of numbers, we need to find the <strong>longest consecutive sequence</strong> (numbers that appear consecutively).</li></ul><h4>Initial Thought Process</h4><ul><li>First, I thought of sorting the array and then using a <strong>map</strong> to store sequences.</li><li>I would then iterate through the array and find the largest sequence stored in the map.</li><li>However, sorting gives an <strong>O(n log n)</strong> complexity, which wasn’t optimal.</li></ul><h4>Simplicity to Complicated</h4><ul><li>Since O(n log n) wasn’t good enough, I tried to improve it. I watched <strong>NeetCode’s solution</strong>, which promised an <strong>O(n) approach</strong>, but when I implemented it, my solution somehow ended up <strong>O(n²)</strong>. 😭</li></ul><h4>Finding the Mistake</h4><ul><li>After debugging, I realized the issue was <strong>duplicate values</strong> in the array. NeetCode’s solution used a <strong>set</strong> to avoid rechecking elements unnecessarily. Once I implemented <strong>sets</strong>, the time complexity <strong>drastically improved</strong>, and my solution finally worked! 🎉</li></ul><h4>Final Approach (O(n) Solution)</h4><ol><li>Use a <strong>set</strong> to store all numbers (avoiding duplicates).</li><li>Iterate through the array, and for each number:</li><li>Check if it’s the <strong>start of a sequence</strong> (i.e., num - 1 is not in the set).</li><li>If it is, count the length of the sequence.</li><li>Track the <strong>longest sequence</strong> found.</li><li>This avoids unnecessary rechecking and runs in <strong>O(n)</strong> time.</li></ol><h3><strong>Final result?</strong> ✅ <strong>Accepted!</strong></h3><h3>🔍 <strong>New Concept of the Day: JavaScript Sets</strong></h3><p>Since today’s LeetCode problem reinforced the importance of <strong>sets</strong>, I took a moment to dive deeper into <strong>JS Sets</strong> and their methods.</p><h4>What is a Set?</h4><p>A <strong>Set</strong> in JavaScript is a collection of <strong>unique values</strong>. Unlike arrays, sets do not allow duplicates, making them perfect for problems where we need <strong>fast lookups and uniqueness</strong>.</p><h4>How to Create a Set?</h4><pre>const mySet = new Set([1, 2, 3, 4, 5]);<br>console.log(mySet); // Set { 1, 2, 3, 4, 5 }</pre><p>You can also add elements one by one:</p><pre>const numbers = new Set();<br>numbers.add(10);<br>numbers.add(20);<br>numbers.add(10); // Won&#39;t be added since 10 already exists<br>console.log(numbers); // Set { 10, 20 }</pre><h4>Useful Set Methods</h4><ul><li><strong>.add(value)</strong> → Adds a new value</li><li><strong>.delete(value)</strong> → Removes a value</li><li><strong>.has(value)</strong> → Checks if a value exists</li><li><strong>.size</strong> → Returns the number of elements</li><li><strong>.clear()</strong> → Removes all values</li></ul><h4>Why Sets Were Useful in LeetCode 128?</h4><ul><li>Fast <strong>O(1) lookups</strong> using .has().</li><li>Avoids unnecessary rechecking of duplicate numbers.</li><li>Reduces the time complexity of finding sequences.</li></ul><p>Nothing groundbreaking, but a <strong>good reinforcement</strong> of how <strong>sets can optimize algorithms</strong> in JavaScript. 🚀</p><h3>Conclusion</h3><p>Today may not have been a <strong>direct</strong> step toward my goal, but the skills I gained —<strong> time management</strong>, <strong>research</strong>, and <strong>presentation</strong> — will be valuable in the long run. <strong>Debugging</strong> my LeetCode solution also reinforced my understanding of <strong>sets in JavaScript</strong>, which will help in future problem-solving. Every<strong> small improvement</strong> adds up, and as long as I keep learning and pushing forward, I’m getting closer to my goal. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10a54b92a4d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Day 1 — Started Blogging]]></title>
            <link>https://medium.com/@njansmailbox/day-1-started-blogging-578767c937f4?source=rss-6e6e37f388c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/578767c937f4</guid>
            <category><![CDATA[my-coding-journey]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[leetcode-solution]]></category>
            <dc:creator><![CDATA[Njan.Codes]]></dc:creator>
            <pubDate>Mon, 10 Mar 2025 01:28:37 GMT</pubDate>
            <atom:updated>2025-03-10T01:28:37.471Z</atom:updated>
            <content:encoded><![CDATA[<h3>Day 1 — Started Blogging</h3><p>From today onwards, I’ve decided to <strong>document my life</strong>, mainly focusing on my <strong>career journey</strong>. This blog will serve as a way to track my progress, hold myself accountable, and hopefully inspire others walking a similar path.</p><h3>My Current Goal?</h3><p>To earn <strong>₹1</strong> from a product I’ve created.</p><p>It doesn’t matter whether it comes from a <strong>SaaS product, a freelance gig, or even a job</strong> — the goal is to make money from something I built. But to simplify things, I’ve chosen to focus on <strong>creating websites and SaaS products</strong> for customers.</p><p>Why this path?</p><ul><li>It allows me to <strong>improve my coding skills</strong> while also learning <strong>marketing, sales, and finance</strong> — essential skills for any entrepreneur.</li><li>Freelancing is a <strong>competitive market</strong>, and I’ve heard that landing a job first helps build credibility.</li><li>This journey will also <strong>strengthen my resume</strong>, making me a stronger candidate for high-paying job opportunities.</li></ul><h3>Long-Term Vision</h3><p>By the time I graduate (which is about <strong>a year and a half from now</strong>), I want to have built and sold <strong>multiple products</strong> — enough to generate some initial income and prove that I can create something valuable.</p><h3>Why Document This Journey?</h3><p>I know that this path will get tough. But by writing about it, I ensure that I <strong>stay committed</strong> instead of abandoning it when things get difficult.</p><h3>How This Blog Will Work</h3><p>Every day, I am going to post a blog about the progress I’ve made, outlining my weekly goal and the to-dos for that day. This way, I can track my journey in a structured way and stay accountable.</p><p>I’ll mostly be writing about:</p><ul><li><strong>Tasks I worked on</strong></li><li><strong>New skills I learned</strong></li><li><strong>How I applied previous skills to real-world problems</strong></li><li><strong>LeetCode progress</strong> — I’m solving LeetCode daily, following the roadmap from NeetCode.io. I’ll write about the problems I solved, my thought process, and what I learned from them.</li><li><strong>New Concept of the Day</strong> — Every day, I’ll explore and write about a new concept related to computer science, whether it’s an algorithm, a system design principle, or an interesting tech topic.</li></ul><p>That’s it for today. Let’s see where this journey takes me. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=578767c937f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>