<?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 lambochin on Medium]]></title>
        <description><![CDATA[Stories by lambochin on Medium]]></description>
        <link>https://medium.com/@leonjasonsanto?source=rss-51f89327b30c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*r0PLNdILn3tCY9-H</url>
            <title>Stories by lambochin on Medium</title>
            <link>https://medium.com/@leonjasonsanto?source=rss-51f89327b30c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:07:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@leonjasonsanto/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[Kubernetes Series — Part 1: Kubernetes Operators]]></title>
            <link>https://medium.com/@leonjasonsanto/kubernetes-series-part-1-kubernetes-operators-c592a7370d38?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c592a7370d38</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Fri, 13 Mar 2026 16:41:34 GMT</pubDate>
            <atom:updated>2026-03-13T16:42:53.689Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a series of articles where I’ll walk through how Kubernetes works, its components, and why it is needed in real-world systems. I’ll also share the knowledge I gained while learning Kubernetes .</p><h4><strong>What is Kubernetes Operator?</strong></h4><p>Normally, without Kubernetes, we use <strong>virtual machines</strong> to run our projects. Typically, we call this the <strong>production environment</strong>. But whenever developers deploy their code, they constantly have to monitor whether the code and its dependencies are working correctly in the production environment. Failovers and maintaining stability become huge trade-offs in this environment.</p><p>That is where the concept of <strong>containers</strong> comes in. Containers give us isolation between different applications we run. They also reduce the extra effort required from the DevOps team to provision hardware or virtual machines just to support an application.</p><p>But even with containers, consider a scenario where we need to run our project across <strong>different virtual machines or nodes</strong>. Now the question becomes: how do we manage dependencies across them, and how do we know how much workload each machine is handling?</p><p>Earlier, this was kind of a <strong>manual process</strong>. Developers or operators would look at the scale of the application, spin up containers on some virtual machines, connect them, and if needed move workloads to other machines. Basically, plug in some containers here, unplug some there, and manage things manually.</p><p>Don’t you think we need something that <strong>automates this entire process</strong>?</p><p>Well, that’s where <strong>Kubernetes</strong> comes in.</p><p>Kubernetes provides an environment where we create <strong>pods</strong> (which are basically groups of containers). These containers are created and managed automatically. But the real question is: <strong>how does that automation actually happen?</strong></p><p>This is where <strong>operators</strong> come into the picture.</p><p>Operators extend the capabilities of Kubernetes by adding automation with some <strong>domain-level knowledge</strong> about specific applications. An operator knows certain resources, watches over them, and has a set of tasks it can perform to move the system from one state to another.</p><p>Operators usually work by defining <strong>Custom Resource Definitions (CRDs).</strong><br>A CRD allows developers to create their own Kubernetes resource types, which the operator then watches and manages automatically.</p><p>In simple terms, it observes the <strong>current state</strong> of the system and compares it with the <strong>desired state</strong>, then performs actions to reconcile the two. This is essentially the core idea behind how Kubernetes works.</p><p>Kubernetes by itself is often enough for <strong>simple or static applications</strong>, like hosting a frontend service. But when it comes to <strong>complex applications</strong> with multiple services like databases, caches, and monitoring systems, managing everything manually becomes a huge challenge.</p><p>That’s where operators really shine, because they automate the operational knowledge needed to manage those complex systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*clCH45D-TyzmLRqSvxlacA.png" /></figure><p><strong>Note:</strong> Kubernetes holds the <strong>custom resources</strong>, and when it receives an order (or message) to reach a target state, it follows a simple process:</p><ol><li>It <strong>observes the current state</strong> of the system.</li><li>It <strong>compares it with the desired state</strong> and identifies the difference.</li><li>It <strong>performs the required tasks</strong> to reconcile the difference and bring the system to the desired state.</li></ol><p>Now let’s look at another example. see the below basic info of the kubernetes architecure with one master node and several worker nodes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubxmyo7_8lgsY-RyJrYJLw.png" /></figure><h3>Some Info to Know Before the Example</h3><p>Before jumping into the example, let’s understand some of the main components involved.</p><p><strong>API Server</strong> — This is the <strong>endpoint through which developers interact with the Kubernetes cluster</strong>. Every command or YAML configuration eventually goes through the API server.</p><p><strong>etcd</strong> — A <strong>key–value store</strong> used by Kubernetes to store cluster metadata and configuration, such as resource definitions from YAML files.</p><p><strong>Scheduler</strong> — Responsible for deciding <strong>which worker node a pod should run on</strong>. It assigns pods to nodes based on resource availability and constraints.</p><p><strong>Controller Manager</strong> — Runs the controllers that <strong>handle the lifecycle of Kubernetes resources</strong>, such as creating, updating, or deleting pods to maintain the desired state.</p><h3>Example of Desired State vs Current State</h3><p>Now consider this situation.</p><p>The user updates the configuration and sets the <strong>desired state</strong> to:</p><pre>replicas = 3<br>//But currently the actual cluster state is:<br>running pods = 1</pre><p>This change updates the <strong>custom resource definition</strong>.</p><p>The <strong>operator notices the change</strong>, observes the current cluster state, and compares it with the desired state. Since they are different, it performs actions through the <strong>API server</strong> to reconcile the difference.</p><p>In this case, Kubernetes creates <strong>two additional pods</strong>, so the total running pods become <strong>3</strong>, matching the desired state.</p><h4><strong>Why Operators Are Usually Used</strong></h4><p>Operators are generally useful for systems that require <strong>statefulness</strong>.</p><p>Stateless applications (like simple frontend services or APIs) usually don’t need this much operational logic.</p><p>But <strong>stateful applications</strong>, such as databases, need additional management for things like:</p><ul><li>replication</li><li>failover</li><li>backups</li><li>consistency</li></ul><p>This is where operators become very useful.</p><p>A common example is <strong>PostgreSQL</strong>. The <strong>Postgres Operator</strong> uses Kubernetes capabilities to manage the database cluster, handle replication, and maintain consistency automatically.</p><p>This approach follows what is called the <strong>Operator Pattern</strong>, which I’ll cover in more detail in the upcoming part.</p><h3>Key Benefits of Using Kubernetes Operators</h3><p>Now that we understand what a <strong>Kubernetes Operator</strong> is, let’s look at some of the key functionalities and benefits it provides.</p><h3>1) Extended Functionality</h3><p>An operator basically <strong>extends the capability of Kubernetes</strong>.</p><p>Without operators, Kubernetes is mainly a container orchestration system where we can create pods on different virtual machines and manage them through a single API endpoint. While Kubernetes already handles things like scheduling and scaling, managing complex applications still requires a lot of manual work.</p><p>To automate more advanced operations, we extend Kubernetes using <strong>operators</strong>. Operators bring additional automation and domain-specific knowledge into the cluster.</p><p>With operators, the system can automatically respond to changes in state and perform operations such as:</p><ul><li><strong>Automated provisioning of resources</strong></li><li><strong>Scaling up or down</strong> based on metrics like user requests per second, latency, or AI/ML workloads</li><li><strong>Failover and automatic recovery</strong> when something crashes</li></ul><p>This makes the system more <strong>self-healing and adaptive</strong>.</p><h3>2) Hybrid Environment Management</h3><p>Operators can also help manage workloads across <strong>different environments</strong>.</p><p>They provide a more <strong>uniform control plane</strong> that helps orchestrate pods across environments such as:</p><ul><li>On-premise infrastructure</li><li>Multi-cloud deployments</li><li>Hybrid cloud environments</li></ul><p>This makes it easier to maintain consistency and manage applications even when they are deployed across multiple platforms.</p><h3>3) Simplifies Kubernetes Automation</h3><p>Operators simplify Kubernetes automation by using mechanisms like the <strong>control loop (reconciliation loop)</strong>.</p><p>Instead of writing a large number of YAML files and manually performing repetitive tasks, operators allow us to encapsulate <strong>domain-level knowledge and operational logic</strong> directly into the system.</p><p>This means:</p><ul><li>Less repetitive configuration</li><li>Less manual intervention</li><li>Easier automation of complex workflows</li></ul><p>In short, operators help Kubernetes <strong>manage complex applications more intelligently</strong> by embedding the operational knowledge directly into the cluster.</p><p>In the next part of this series, I’ll explain the Operator Pattern and on How K8s Operators Manage Kubernetes Applications</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c592a7370d38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[16/365 Days to Crack GSoC / Job — A Daily Grind Log]]></title>
            <link>https://medium.com/@leonjasonsanto/16-365-days-to-crack-gsoc-job-a-daily-grind-log-8283c001c38b?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8283c001c38b</guid>
            <category><![CDATA[grind]]></category>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Fri, 15 Aug 2025 17:38:08 GMT</pubDate>
            <atom:updated>2025-08-15T17:38:08.231Z</atom:updated>
            <content:encoded><![CDATA[<h3>16/365 Days to Crack GSoC / Job — A Daily Grind Log</h3><h4>Todays is day 16 of grinding to preprare for gsoc and to land in a job in one year and heres what i ve done in day 16</h4><h3>Problem Statement</h3><p>You are given two linked lists, <strong>list1</strong> and <strong>list2</strong>, along with two integers, <strong>a</strong> and <strong>b</strong>. Your task is to remove the nodes of <strong>list1</strong>from the <strong>a</strong>-th node to the <strong>b</strong>-th node (inclusive) and insert <strong>list2</strong> in their place.</p><p>For example, if <strong>list1</strong> = [0, 1, 2, 3, 4, 5], <strong>a</strong> = 3, and <strong>b</strong> = 4, you would remove the nodes with values 3 and 4. If <strong>list2</strong> = [100, 101, 102], the final merged list should be [0, 1, 2, 100, 101, 102, 5].</p><h3>Intuition</h3><p>The intuition is straightforward. We just need to find the two “stitching” points in <strong>list1</strong>:</p><ol><li>The node just <strong>before</strong> the section to be removed. Let’s call this the <strong>start_node</strong>. This will be at index <strong>a</strong> — 1.</li><li>The node that comes <strong>after</strong> the section to be removed. Let’s call this the <strong>end_node</strong>. This will be at index <strong>b</strong> + 1.</li></ol><p>Once we’ve marked these two points, we can simply traverse to the tail of <strong>list2</strong> and connect the pointers to merge the lists.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PNIeaq1BW2EJ4rHa2ualsw.png" /></figure><p>Here’s the step-by-step logic for this approach:</p><ol><li><strong>Find the </strong><strong>start_node</strong>: Traverse <strong>list1</strong> to find the node just before the removal section (the node at index <strong>a</strong> - 1).</li><li><strong>Find the </strong><strong>end_node</strong>: Continue traversing from there to find the node that comes just after the removal section (the node at index <strong>b</strong> + 1).</li><li><strong>Find the tail of list2</strong>: Traverse <strong>list2</strong> all the way to its last node.</li><li><strong>Connect the pointers</strong>:</li></ol><ul><li>Point the next of the <strong>start_node</strong> to the head of <strong>list2</strong>.</li><li>Point the next of the tail of <strong>list2</strong> to the <strong>end_node</strong>.</li></ul><p>Heres the code</p><pre># Definition for singly-linked list.<br># class ListNode:<br>#     def __init__(self, val=0, next=None):<br>#         self.val = val<br>#         self.next = next<br>class Solution:<br>    def mergeInBetween(self, list1: ListNode, a: int, b: int, list2: ListNode) -&gt; ListNode:<br>        head1=None<br>        head2=None<br>        curr=list1<br>        prev=None<br>        i=0<br>        while curr:<br>            if i==a:<br>                head1=prev<br>            if i==b:<br>                head2=curr.next<br>            prev=curr<br>            curr=curr.next<br>            i+=1<br>        # if head1 and head2:<br>        head1.next=list2<br>        curr=list2<br>        while curr.next:<br>            curr=curr.next<br>        curr.next=head2<br>        return list1<br>        # if not head1:<br>        #     curr=list1<br>        #     while curr.next:<br>        #         curr=curr.next<br>        #     curr.next=head2<br>        #     return list2<br>        # if not head2:<br>        #     head1.next=list2<br>        #     return list1</pre><p>The funny part is that the problem gave a constraint: 1 &lt;= a &lt;= b &lt; list1.length - 1. Ignoring that constraint, I computed every possible scenario and wrote code for all of them(can refer in the part of code where i commented , until I tried a few test cases and realized they all pointed back to those constraints. Next time, I will make sure to read the constraints properly!</p><h3>GITHUB</h3><p><strong>goal today is to understand how medplum works for the selected issue today i will have a high level understanding of how routing handled for that debugginh paritcular issue</strong></p><p>Today i,same medplum repo i am trying to understand but ,the current situratin is i do managed to run this on my local computer dispite some errors i was able to do it in the end after some debuggig,I recently slected the issue where i have to create a bot using openAi and realised i have to pay to give req to openAI,So i reselcted some other issue that uses AWS teseract<br>the issue: AWS tesseracrt uses pagingatin in the form of Nexttoken but in this case there is an some error in fetching the token it seems so the next token in not configured properly so i ran and first checked how frontend of it works lilke how the request goes to backend and how the client that is connecting the db is coded</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XSP7u21STEyYOe7nCgrhpQ.png" /></figure><p>From what i found in this form only particularly AWS teseract req is sent,First i found the Admin Router and in it i navigate to and check how the req went to medplum client,From here it goes to the server and from the server for AWS textextract operatin textextract bot is triggred to handle everything.So from here i ve yet to figrure out and then my first goal would be to run the AWS textextract in my localhost</p><h3>SelfProject</h3><p><strong>Today&#39;s goal is to write the User and Rooms classes for handling the WebSocket routes. Note: this project is similar to a 2D metaverse like Zep where people interact with each other, potentially with audio and video.</strong></p><p>At a high level, I am going to design two classes. One is the User class, which is unique for each user and has their own WebSocket instance for sending and receiving messages.</p><p>Let&#39;s talk about the scenarios where this WebSocket can be used and code them appropriately. When we think about it:</p><ol><li>The first thing that comes to mind is that users have to join a space. Then, what are the requirements?</li></ol><ul><li>SpaceId (users have to know which space to join)</li><li>UserId (so that we can log which users connect to the spaceId)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wsEYqTg5fP04SvgTBEQafw.png" /><figcaption>consider the image ,here we are joining a user 3 to a space</figcaption></figure><h4>Key Takeaways from the Above Image</h4><p><strong>First</strong>, the user who wants to join can send a join request with a spaceId and a UserToken (which can be converted to userId in my case using JWT verify).</p><p><strong>Second</strong>, we make sure to add the user to the RoomManager class because that is where we store the list of users who are connected to the spaceId.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nCYmjUlaNErp3LlCvMpVxA.png" /><figcaption>Here we are creating a randowm spawn point within the space for the user who gave the join req</figcaption></figure><p>We define a random spawn point for the user, then our next goal is to broadcast this to the rest of the users, for which we will use the WebSocket instance created for the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mebnJ1uZlq4Ckcd1Cz0MoQ.png" /></figure><p>Here, once the user has joined, the message should be immediately sent to the other users so that it reflects on their screens too, since they are in the same space. So we write a broadcast message which reaches the WebSocket, which in turn reaches the RoomManager that has a list of users. We then send the message with the spawn point to each of the users.</p><p>Thank you for your time to see my grind. Though not extreme, I want to make it consistent.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8283c001c38b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[15/365 Days to Crack GSoC / Job — A Daily Grind Log]]></title>
            <link>https://medium.com/@leonjasonsanto/15-365-days-to-crack-gsoc-job-a-daily-grind-log-b44f7c9c3007?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b44f7c9c3007</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[gsoc]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Tue, 12 Aug 2025 18:37:17 GMT</pubDate>
            <atom:updated>2025-08-12T18:37:17.837Z</atom:updated>
            <content:encoded><![CDATA[<h3>15/365 Days to Crack GSoC / Job — A Daily Grind Log</h3><p>Now moving on to the next question in the list: <strong>2181. Merge Nodes in Between Zeros</strong>. Linked List questions are easy but irritating sometimes. This question follows a pattern of <strong>Linked List Traversal</strong> and in-place modification.</p><h3>Given Statement</h3><p>You are given a list of nodes separated by zeros. Add all the elements between the zeros and alter the list in such a way that only those summed nodes exist. <strong>Note:</strong> The list starts and ends with zeros by default.</p><h3>Intuition</h3><p>The intuition is simple. We just have to lock onto a zero node, use it as a placeholder, and then compute the sum of all the other elements that follow. When we hit the next zero, we just make the value of the placeholder zero equal to the sum we calculated. Then we point it to the next section of the list, ignoring all the elements we just computed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XwKEWgsqcGFhKe321wt48g.png" /></figure><p>As shown in the diagram, the process starts by “locking” onto the first zero element. We then move to the next nodes (3and 1) and add their values. Once we reach the next zero, that&#39;s our signal to modify the list.</p><p>The process can be broken down into two main steps for each segment:</p><ol><li>Take the calculated <strong>sum</strong> of all the in-between variables and store this value in the first zero node.</li><li>Update the <strong>next pointer</strong> of this first zero node to point to the second zero node, effectively skipping all the elements in between that you just summed up.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HoWl9Uz7jg_siVN4Gw72Jg.png" /></figure><p>Heres the code</p><pre># Definition for singly-linked list.<br># class ListNode:<br>#     def __init__(self, val=0, next=None):<br>#         self.val = val<br>#         self.next = next<br>class Solution:<br>    def mergeNodes(self, head: Optional[ListNode]) -&gt; Optional[ListNode]:<br>        curr=head.next<br>        dummy=head<br>        ans=0<br>        while curr:<br>            if curr.val!=0:<br>                ans+=curr.val<br>            else:<br>                dummy.val=ans<br>                ans=0<br>                if curr.next:<br>                    dummy.next=curr<br>                    dummy=dummy.next<br>                else:<br>                    dummy.next=None<br>            curr=curr.next<br>        return head</pre><h3>Self Project</h3><p>Today’s plan is to design WebSocket rooms that can maintain a list of users who are present and moving. I’ve learned how WebSockets work, and now I’m trying to understand every endpoint from top to bottom to figure out how to integrate everything.</p><h4>WebSocket Plan for My Project</h4><p>Let’s say a user wants to join a particular space. To join, they will need two key pieces of information:</p><ol><li><strong>spaceId</strong>: The unique ID for that specific space.</li><li><strong>Authentication</strong>: We probably can’t give the userId directly for security reasons. Instead, the client can send a userToken (like a JWT), which the server can then verify to authenticate the user before adding them to the space.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-NMLMKZIsgObOwQPp0xWw.png" /></figure><p>When a user joins a space, the server should handle three key events:</p><ol><li><strong>Initial Position</strong>: The new user must be assigned an initial (x,y) position, which can be randomly set within the space&#39;s boundaries.</li><li><strong>State Synchronization</strong>: The joined user needs to receive information about all <strong>existing users</strong> in the space and their current positions.</li><li><strong>Broadcast Arrival</strong>: All <strong>existing users</strong> in the space must be notified that a new user has joined and where they are located.</li></ol><p><strong>Assigning a Position:</strong>When a user first connects to a space’s WebSocket endpoint, the server will generate a random (x, y) coordinate pair that falls within the predefined dimensions of that space. This becomes the user&#39;s starting position.</p><p><strong>Managing Server Stat:</strong>To keep track of who is in which space, the server can use a Map data structure. A good structure would be a map where the key is the spaceId and the value is another map containing each userId and their corresponding position.</p><pre>Map&lt;string:Users[]&gt;</pre><p>Here User is a whole class which has information about the list of userID ,spaceId,x and y etc.When the new user connects, the server first adds them to this data structure. It then sends a message <em>only to the new user</em>containing the full list of other users currently in the space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vFl7uDwKVAj0lEywZ4plWA.png" /><figcaption>2)This above figure reciving all the user informatino from Rooms data structure which is a map of spaceId to the list of Users so that for each user i will know the list of all users</figcaption></figure><p><strong>3. Broadcasting the New User</strong>:After the new user has been added to the map, the server must broadcast a new_user_joined message to all <em>other clients</em>connected to that same spaceId. This message should include the new user&#39;s ID and their initial position, allowing existing clients to render them in the space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sc_wuoXb2zNee3JY_NFrsA.png" /><figcaption>3)This above figure shows how message of joining a space gets broadcasted</figcaption></figure><p>still there are lot of logic that are yet to complete</p><h3>GitHub</h3><p>I hadn’t touched the Medplum repo for quite a long time until yesterday. I updated my fork with the latest main branch and then immediately hit an error: S2322: Type ‘number’ is not assignable to type ‘Timeout’ on lines that use setInterval or setTimeout.</p><p>This error was interesting. After fetching the new version, it seems my @types/node definitions were causing a conflict. TypeScript expected setTimeout to return a NodeJS.Timeout object, but the environment was providing a number.</p><p>My fix was to find where setTimeout and setInterval were described in the type definitions and change the return type to what was expected. And now it works—the build is successful! 🎉</p><p>Still, it buggles me. I posted a query on their official GitHub to ask whether this is something that usually happens for other devs or if it was just an issue on my end. Let’s see how it turns out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b44f7c9c3007" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[14/365 Days to Crack GSoC / Job — A Daily Grind Log]]></title>
            <link>https://medium.com/@leonjasonsanto/14-365-days-to-crack-gsoc-job-a-daily-grind-log-2c3a81f5fe9c?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c3a81f5fe9c</guid>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Mon, 11 Aug 2025 20:00:26 GMT</pubDate>
            <atom:updated>2025-08-11T20:00:26.253Z</atom:updated>
            <content:encoded><![CDATA[<h3>14/365 Days to Crack GSoC / Job — A Daily Grind Log</h3><p>I’ve fully completed all the DP problems with their different patterns! Now, let’s go to <strong>Linked Lists</strong>. I already know some of the jargon since I’ve solved some of the problems before. Let’s see what patterns are there, and we’ll cover all of them in the next 15 days or so.</p><p>The patterns in Linked Lists go like this:</p><ul><li>Linked List Traversal &amp; Reversal (10 qn)</li><li>Fast &amp; Slow Pointer (7 qn)</li><li>Two Pointers (5 qn)</li><li>Design / Doubly Linked List (2 qn)</li><li>Override Value (2 qn)</li><li>Monotonic Stack (1 qn)</li><li>DFS/BFS (7 qn)</li><li>Design (6 qn)</li><li>Delete Nodes (5 qn)</li><li>Sorting (1 qn)</li><li>Prefix Sum (1 qn)</li></ul><p>I know I can’t solve every single one of these problems, considering I only want to spend 15 days on this topic. So, I will make sure I visit all the patterns and am clear with them by the end of the 15 days.</p><p>So today was a rather calm day. I solved 3 easy questions. Linked Lists are not as hard as DP in my opinion. Mostly, there’s only one type of solution, and I don’t have to think about bottom-up vs. top-down or recursive vs. iterative approaches.</p><h3>1291. Convert Binary Number in a Linked List to Integer</h3><p><strong>Problem Statement:</strong> Given the head of a singly linked list where each node contains a 0 or a 1, the list represents a binary number. Return the decimal (base 10) version of this number.</p><h3>1291. Convert Binary Number in a Linked List to Integer</h3><p><strong>Problem Statement:</strong> Given the head of a singly linked list where each node contains a 0 or a 1, the list represents a binary number. Return the decimal (base 10) version of this number.</p><p>So, for a list like 1 -&gt; 0 -&gt; 1, the binary number is 101, which is 5 in decimal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*6ODZOv10CDYFHEMVFFxlNA.png" /></figure><p>Just multiply each value and volla we get the result simple right.so how do we got to start from head first element so we are going with upperboud we have to find the leanth first and thern we will computer based on leangth.Heres the code</p><pre># Definition for singly-linked list.<br># class ListNode:<br>#     def __init__(self, val=0, next=None):<br>#         self.val = val<br>#         self.next = next<br>class Solution:<br>    def getDecimalValue(self, head: Optional[ListNode]) -&gt; int:<br>        curr=head<br>        n=0<br>        while curr:<br>            n+=1<br>            curr=curr.next<br>        print(n)<br>        curr=head<br>        ans=0<br>        i=1<br>        while curr:<br>            ans+=curr.val*(2**(n-i))<br>            curr=curr.next<br>            i+=1<br>        return anspp</pre><h4>2) Reverse the Linked List</h4><p>This is a classic problem, and it’s easy once you see the trick. It’s more like re-wiring pointers than swapping values.</p><p>First, we need two pointers to keep track of our progress: curr and prev. curr will be the current node we are processing, starting at the head, and prev will be the node <em>before</em> the current one. Since nothing comes before the head, we initialize prev as None.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*pAnF4xjmyn785Jl2Y_HK2Q.png" /></figure><p>The goal is to make the head node&#39;s next pointer point to the prev element (None). But here&#39;s the problem: if we immediately set curr.next = prev, we lose the link to the rest of the list (the original head.next). We won&#39;t be able to move to the next element to continue the process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*l8KMXRuOxrRTQbdXNE428w.png" /></figure><p>To solve this, we need a third temporary pointer and a specific sequence of operations. For every node, we perform a four-step “dance”:</p><ol><li><strong>temp = curr.next</strong>: First, and most importantly, we store the next node in a temporary variable before we break the connection.</li><li><strong>curr.next = prev</strong>: Now we can safely reverse the pointer. The current node now points backward.</li><li><strong>prev = curr</strong>: We update prev to be our current node, as it&#39;s now the last node in our reversed section.</li><li><strong>curr = temp</strong>: We move to the next node in the original list, which we saved in temp.</li></ol><p>We just repeat these four steps until curr becomes None. At the end of the loop, prev will be pointing to the new head of the fully reversed list.</p><h3>Self Project</h3><p>I’ve almost completed the server (HTTP) endpoints and their testing. The WebSocket implementation is still missing, which I am studying right now. Here’s the commit with the latest implementation:<a href="https://github.com/jasonsantoleo/2dmetaverse/commit/217ae161e15d8478dcdfdc86a0143b64f4bcd96d">https://github.com/jasonsantoleo/2dmetaverse/commit/217ae161e15d8478dcdfdc86a0143b64f4bcd96d</a></p><h3>Open Source</h3><p>How many days has it been? I can’t really concentrate on open source. It’s sad because this grind is mainly for open source, but I can’t seem to put the hours in. Anyway, I will try to dedicate more time.</p><p>Today, like always, I just ran the build to see what would happen. Before, all the tests passed, but when I tried it now, they failed. I had updated my forked repo (simple 🤓, I don’t even know why I did that). It seems that when I ran git fetch upstream and merged the changes, some of the updates had new requirements that aren&#39;t installing correctly in my build.</p><p>I’m trying to find a way to debug it, but it’s 1:30 AM now. It’s time to go to bed so I can keep my grind going tomorrow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c3a81f5fe9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[13/365 Days to Crack GSoC / Job — A Daily Grind Log]]></title>
            <link>https://medium.com/@leonjasonsanto/13-365-days-to-crack-gsoc-job-a-daily-grind-log-eb6ee0cdeaea?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb6ee0cdeaea</guid>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Sat, 02 Aug 2025 05:28:21 GMT</pubDate>
            <atom:updated>2025-08-02T05:28:21.248Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>lee13/365 Days to Crack GSoC / Job — A Daily Grind Log</strong></h3><p>Today was Day 13 of my LeetCode/GSoC/self-project grind. It’s bad that I wasn’t disciplined enough today; that lack of discipline really struck me and I felt quite bad. Anyway, I’m trying to focus on what I have control over. With that being said, I did a question on the LeetCode pattern.</p><p><strong>123. Best Time to Buy and Sell Stock III</strong></p><p>These decision-making pattern questions feel quite easy as compared to other patterns, I hope.</p><p><strong>Question:</strong> Given a list of stock prices, find the maximum profit that can be achieved with <strong>at most two transactions</strong>.</p><p>This is similar to the other “Best Time to Buy and Sell Stock” problems, but with only one catch: at most two transactions. This can be achieved easily with an add-on of a counter to our state.</p><p>In DP, we can solve this in two ways with two methods, so there are a total of 4 different types of solutions:</p><ol><li>Top-down (can be recursive or iterative)</li><li>Bottom-up (can be recursive or iterative)</li></ol><p>For convention, I solve only two variations in every blog. I can’t spend time and write four different approaches; though it’s easy, it takes time to write it all out. Thus, I give only two solutions: 1) Top-down (recursive) and 2) Bottom-up (iterative).</p><p><strong>Top-down approach</strong></p><p>Here, like the other stock variations (the one with cooldown or the one with fees), we have two possibilities: we haven’t bought or we have bought. Based on that, the decision changes to either max(buy, skip) or max(sell, skip). One note: when we are maximizing -prices[i] + … for a buy, we are actually minimizing the buying amount in our DP state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*HCzewPpRPjl9GrSnE1Gt5Q.png" /></figure><p>So, from the figure above, we have two choices: max(Buy, skip) if no stock is held, or max(Sell, skip) if a stock is held. Based on that, we will have appropriate recursive calls. The new part here is a transaction counter, x, that we pass along. When we sell, we increment x to mark one complete transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*S6TjZB3nrIsQ8bLM8NZd7A.png" /></figure><p>Notive i use map instead of listt it is a common pitfall when it comes to dp we have to sacrifice every time we give (i,stock,x) python hashes it it takes some latencu as compare to just dp list which is contiguoutg.situation like this i reseacrd and cam to a conslusion that iteratibe shoudl be used on these pitfalls</p><p><strong>Bottom-up (iterative)</strong></p><p>The bottom-up approach is fairly simple concept-wise, but it takes some time to understand. Well, at least it took me some time. Since I am familiar with the buy and sell pattern now, I was able to come up with this solution.</p><p>So, for every index i in our iteration, we usually check dp[i][0] for “buy” and dp[i][1] for “sell”. But for this problem, we need four states to track up to two transactions:</p><ul><li>State 0: After our <strong>1st buy</strong>.</li><li>State 1: After our <strong>1st sell</strong>.</li><li>State 2: After our <strong>2nd buy</strong>.</li><li>State 3: After our <strong>2nd sell</strong>.</li></ul><p>So for every iteration i in the prices list, we update our dp table:</p><ul><li>dp[i][0] (1st buy): max(dp[i-1][0], -prices[i]). Either we hold our previously bought stock or we buy for the first time today.</li><li>dp[i][1] (1st sell): max(dp[i-1][1], dp[i-1][0] + prices[i]). Either we do nothing after our first sale, or we sell the stock we just bought.</li><li>dp[i][2] (2nd buy): max(dp[i-1][2], dp[i-1][1] — prices[i]). Either we hold our second stock, or we make our second purchase today (our profit comes from after the first sale).</li><li>dp[i][3] (2nd sell): max(dp[i-1][3], dp[i-1][2] + prices[i]). Either we do nothing after our second sale, or we sell our second stock.</li></ul><p>The final answer is the max profit after the last day, which would be dp[len(prices)-1][3].<br> Heres the code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*uOERulU7_tmBww8trG_HsQ.png" /></figure><p><strong>Leetcode | Github</strong></p><p>i probabluy wont do any of this today since i have to create ppt and video for sbi life and tech synthesis hackathon.i willl try my best probable wake up to 2.00 pm</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb6ee0cdeaea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[12/365 Days to Crack GSoC / Job — A Daily Grind Log]]></title>
            <link>https://medium.com/@leonjasonsanto/12-365-days-to-crack-gsoc-job-a-daily-grind-log-49ede7e0bea1?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/49ede7e0bea1</guid>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[grind]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Wed, 30 Jul 2025 17:35:08 GMT</pubDate>
            <atom:updated>2025-07-30T17:35:08.246Z</atom:updated>
            <content:encoded><![CDATA[<h3>12/365 Days to Crack GSoC / Job — A Daily Grind Log</h3><p><strong>Day 12:</strong> I sadly didn’t post articles for about 10 days due to my internal examinations and ServiceNow training. I totally understand — no excuses. From today onwards, I’ll be consistent, irrespective of exams.</p><p>So today, we’re going through a new pattern: <strong>Decision Making</strong>. The concept is rather simple. The point is to choose one of the options (usually two) in a way that would get the maximum result.</p><p>Here’s the statement: The general idea for this type of problem is to decide <strong>whether to take or not take</strong> the current item to reach the optimal result. Essentially, we’re making a decision at each step.</p><p>Questino Bank <br><a href="https://leetcode.com/problems/house-robber/">198. House Robber</a> <br><a href="https://leetcode.com/problems/best-time-to-buy-and-sell-stock/">121. Best Time to Buy and Sell Stock</a> Easy<br><a href="https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/">714. Best Time to Buy and Sell Stock with Transaction Fee</a> medium<br><a href="https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/">309. Best Time to Buy and Sell Stock with Cooldown</a> Medium<br><a href="https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/">123. Best Time to Buy and Sell Stock III</a> Hard<br><a href="https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/">188. Best Time to Buy and Sell Stock IV</a> Hard</p><p><strong>Statement:</strong> Given a set of values, find an answer with an option to choose or ignore the current value.</p><p><strong>Approach:</strong> If you decide to take the current value, then pick either:</p><ol><li>The result from the previous state where the item was ignored.</li><li>The result from the previous state where the item was also not ignored.</li></ol><p>Similarly, if you decide to ignore the current value:</p><ol><li>Use the result from the previous state where items were already used.</li></ol><p>This is the rough template. It could be wrong; I have yet to learn a lot about this pattern.</p><p>The first two questions on this pattern are fairly simple. I solved them on previous days but wasn’t able to blog about it due to exams. Let’s go to the third question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8WrXCqLvChoaOn_7Qv27aw.png" /></figure><p>This is the rougthj template dont ,it could be wrong i have yet to learn a lot about this pattern</p><p>so then First two question on this pattern is fairly simple i solved it on previois days but i can able to blog it due to exams lets go to the third quesrtion</p><p>Lets solve third questino | <a href="https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/">714. Best Time to Buy and Sell Stock with Transaction Fee</a> medium<br>Its a identical twon of the second problem with just a small change that the process of buying and selling can happen multiple times. The questin asks us to buy and sell in such a way that it would get maximum sum plus there is a tracsaction fees which can be easily applied but in question they said Buy and sell with transaction fee most people end up doing for both selling and buying which is not the question intended.we have to minus only one value <br>so lets solve<br>Top-down approach</p><p>This isn’t a very hard approach to form since we solved the base question before. We usually have two decisions, but here it depends on whether we are currently holding a stock or not. We can use a flag for this.</p><p>There are two main states:</p><ol><li>When we have no stock, we can either <strong>buy</strong> or <strong>skip</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*pZXDq019WyOPfGvSW-DCyQ.png" /></figure><p>2) When we have a stock, we can either <strong>sell</strong> or <strong>skip</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*VSD3lHBLOxPWUB-qFK0jbg.png" /></figure><p>So it depend on weather stock is selected or not since it is only,we can use flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*1iK_jTsOnBu2ZdH5i2ruqA.png" /></figure><p>believe the loop goes something similar to this. Let’s talk about the base case. There is only one base case in this pattern: when there are no more elements to judge. I’m guessing it’s when i &gt;= len(prices).</p><p>Let’s talk about each of the cases:</p><ol><li><strong>When we have a stock:</strong> It’s time to decide whether to sell. We can sell the stock now (adding prices[i] to our profit and subtracting the fee) or we can totally skip selling and hold it.</li><li><strong>When we don’t have a stock:</strong> Here we can either buy a stock or ignore it. Since we are doing a sell-buy calculation, it’s better to structure the recursive call as solve(i+1, True) - prices[i]. The True flag indicates that we now hold a stock for the next iteration. Or, we can do a simple skip.</li></ol><p>Heres the solution</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*FyNdY9tOU7tdcPoM6HxW9A.png" /></figure><p><strong>Bottom top approach <br></strong>When we think about the bottom-up approach, there are two variables that change: one is the index of the number, and the other is the stock flag. So we can form a DP table something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*06pbvWn9B-8rBKryVAQmDA.png" /></figure><p>We can build a linear solution with the help of DP. We start from day one, since we have to precompute for the first element. Let’s define our DP states for each day i:</p><ul><li>dp[i][0]: The maximum profit on day i if we <strong>do not</strong> hold a stock.</li><li>dp[i][1]: The maximum profit on day i if we <strong>do</strong> hold a stock.</li></ul><p>For every day i:</p><ol><li>dp[i][0] (no stock): We have two options. We can either skip (do nothing) and carry over the profit from dp[i-1][0], or we can sell the stock we were holding, which would be dp[i-1][1] + prices[i] - fee. We take the max of these two.</li><li>dp[i][1] (holding stock): Here, too, we have two options. One is obviously to skip and just hold the stock from yesterday, so we take dp[i-1][1]. The other option is to buy a stock today (coming from a state of no stock), which would be dp[i-1][0] - prices[i]. We take the max of these two.</li></ol><p>So, if we look closely, the dp[...][0] state is always trying to maximize our cash on hand (after a sale), and the dp[...][1] state is trying to maximize our potential profit (by holding a stock bought at the best possible effective price).</p><p>Here’s the code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*2u4gy8tXoLTHJUQ0pxLQLQ.png" /></figure><p>Hope you liked it</p><h3>Self Project</h3><p>Today, I picked up the self-project I had dropped. I studied database schema design for a website like my project — a 2D metaverse, similar to a ZEP clone.</p><pre>// This is your Prisma schema file,<br>// learn more about it in the docs: https://pris.ly/d/prisma-schema<br><br>// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?<br>// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init<br><br>generator client {<br>  provider = &quot;prisma-client-js&quot;<br>}<br><br>datasource db {<br>  provider = &quot;postgresql&quot;<br>  url      = env(&quot;DATABASE_URL&quot;)<br>}<br><br>model User {<br>    id  String @unique @id @default(cuid())<br>    username String @unique <br>    password String <br>    avatarId String ?<br>    role Role<br>    avatar Avatar? @relation(fields:[avatarId],references:[id])<br>}<br><br>model Space{<br>    id String @unique @id @default(cuid())<br>    name String<br>    thumbnail String<br>    width Int <br>    height Int<br>    elements SpaceElements[]<br>}<br><br>model SpaceElements{<br>    id String @id @unique @default(cuid())<br>    spaceId String<br>    elementId String<br>    x Int<br>    y Int<br>    space Space @relation(fields:[spaceId],references:[id])<br>    element Elements @relation(fields:[elementId],references:[id])<br>}<br><br>model Elements{<br>    id String @id @unique @default(cuid())<br>    width Int<br>    height Int <br>    imageUrl String<br>    static Boolean<br>    spaces SpaceElements[]<br>    mapElements MapElements[]<br>}<br><br>model Map{<br>    id String @id @unique @default(cuid())<br>    width Int<br>    height Int <br>    name String<br>    mapElements MapElements[]<br>}<br><br>model  MapElements{<br>    id String @id @unique @default(cuid())<br>    elementId String<br>    mapId String<br>    x Int<br>    y Int <br>    element Elements @relation(fields:[elementId],references:[id])<br>    map Map @relation(fields:[mapId],references:[id])<br>}<br><br>model Avatar{<br>    id String @id @unique @default(cuid())<br>    name String<br>    imageUrl String<br>    users User[]<br>}<br><br>enum Role{<br>    User<br>    Admin<br>}</pre><h3>Medplum</h3><p>I’m still trying to understand the <strong>Medplum</strong> repo. I understand the issue I picked is about an OpenAI integration, but it charges around ₹40 per request, which is like a virus to my bank account since I’m a student! I’ll try to understand this repo more and keep you updated. I’ve decided to aim for GSoC next year with an organization that uses healthcare technologies, similar to Medplum.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49ede7e0bea1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[11/365 Days to Crack GSoC / Job — A Daily Grind Log]]></title>
            <link>https://medium.com/@leonjasonsanto/11-365-days-to-crack-gsoc-job-a-daily-grind-log-23a37d0c9093?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/23a37d0c9093</guid>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[grind]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Thu, 17 Jul 2025 18:29:21 GMT</pubDate>
            <atom:updated>2025-07-17T18:29:21.632Z</atom:updated>
            <content:encoded><![CDATA[<h3>11/365 Days to Crack GSoC / Job — A Daily Grind Log</h3><p>Today is day 11 of my grind to reach a level that would make me get a job or GSOC. So in this article, I’m putting a log of what I do every day after college.</p><h3>Overview</h3><p>I’m doing a LeetCode question named <strong>1143. Shortest Common Supersequence</strong> — it’s a hard problem. Sure is tough! I couldn’t come up with solutions even after solving LCS (Longest Common Subsequence). It’s more like a prerequisite for solving this problem.</p><h3>LeetCode 1143: Shortest Common Supersequence</h3><p><strong>Given statement</strong>: Given two strings str1 and str2, we have to return the shortest string that has str1 and str2 as subsequences. I thought I could solve it, but then when I think about it… Oof, tough right!</p><p>So at first, I thought about the DP approaches we used in the previous question and compared them all. I even looked at LCS, but it was still hard to come up with a solution. After all those hours, I was able to solve it!</p><h3>The Approach</h3><p>The thing is, for each iteration, we have to go to the longest subsequence string. Say two strings ‘abac’ and ‘cab’. We have to go to the length with the common subsequence. Let’s iterate from backwards.</p><p>Say ‘abac’ and ‘cab’ are the strings. On the first iteration, say i,j is the last element of the list. We compare if it’s different and not the same. We check which contributes to the longest subsequence: ‘aba’,’cab’ or ‘abac’,’ca’. You got it right — it’s ‘aba’,’cab’! So we go to that string while appending the popped element (i.e., ‘c’).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*CnOTvymqv-RfuTOym7kY8g.png" /></figure><p>Now, what if the elements are the same? This is where we trim and try to get the shortest subsequence. So we add one element to the string while skipping the other. Say if i and j are both ‘a’ and ‘a’, we add only one ‘a’. It kinda goes like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1G78ieBfH6UFJZMft2RUQg.png" /></figure><p>Also, in the above statement, when either element reaches zero, we just add the remaining elements to the result.</p><p><strong>Bottom-Up Approach</strong><br>Here’s the solution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*svZ8P1P3ih5JEQkKqelntg.png" /></figure><p>Bottom-Top Approach</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FIhxGBoNCSBaForPeExH4Q.png" /></figure><p>FInal Summary</p><ol><li><strong>First, find the LCS</strong>: We use dynamic programming to find the longest common subsequence length</li><li><strong>Then, construct the supersequence</strong>: We backtrack through the DP table to build the actual string</li><li><strong>Handle matches carefully</strong>: When characters match, we add them only once to avoid duplication</li><li><strong>Choose the optimal path</strong>: When characters don’t match, we choose the path that leads to the longer LCS</li></ol><p>The tricky part is the reconstruction phase where we need to carefully decide which character to include based on the DP values we computed earlier</p><p><strong>Github<br></strong>since i am new to open source i tried to build what they asked but since it uses open api it feels costly to run the test around freely since it cost some so i will understand more of repo.I try to go till the end of the month ones i understand this repo i could easily contribute.Hope so <br><strong>Self Project <br></strong>As i told i put the curreent self project asiide since i plan on doing world hacker league compititon .I have plan on a project but implementation is really hard i will dicuss the architecture of my project soon feel free to give feed back</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23a37d0c9093" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10/365 Days to Crack GSoC / Job — A Daily Grind Log]]></title>
            <link>https://medium.com/@leonjasonsanto/10-365-days-to-crack-gsoc-job-a-daily-grind-log-348de615dfd3?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/348de615dfd3</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[leetcode]]></category>
            <category><![CDATA[grind]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 15:24:47 GMT</pubDate>
            <atom:updated>2025-07-15T15:24:47.235Z</atom:updated>
            <content:encoded><![CDATA[<h3>10/365 Days to Crack GSoC / Job — A Daily Grind Log</h3><p>This is day 10 of the grind in doing the GSoC/Job grind. Having a goal set makes me work for it in a more structured way. The grind consists of three things: LeetCode, GitHub, and self-projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*zgnrgpzcnhBYhCnl-55GgQ.png" /></figure><h3>LEETCODE</h3><p>Today’s problem is Code 516. Longest Palindromic Subsequence.</p><p><strong>Problem Statement:</strong> Given a string, find the largest palindromic subsequence of length s.</p><p><strong>Note:</strong> Substring and subsequence are different. Substring is continuous but subsequence is not continuous. For example, take “aaaba” — here we can’t form a substring “aaaa” because there is ‘b’ in between, but we can form “aaaa” as a subsequence.</p><p>This problem follows the same pattern. We do two things:</p><ol><li>Check if the first and last elements are the same, then we call the elements + 2 (which is the length of the first and last which is two) in between the first and last and check if it is palindrome.</li><li>If the first and last are not the same, then we pass it as two possible substrings: one removing the first element and second removing the last element, and check if any subsequence forms a palindrome.</li></ol><p><strong>Base cases (two base cases):</strong></p><ol><li>When first element &gt; last element → return 0</li><li>When first element == last element → return 1</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*3N5bpkAuE-9oERRqmsfCyA.png" /></figure><h3>Bottom-up Approach</h3><p>Here in the bottom-up approach, we do an n² loop that goes from small subsequence to larger subsequence. Before that, there are some base things we have to do. I noticed that for strings of length 1 and 2, there is no need for dp to fetch its subproblems because we can take it as 1 and 2 respectively. So we adjust this loop based on that and essentially start the l from 2 so that the subsequence we are calling is minimum length of three that makes it eligible for calculating subproblem (subsequence).</p><p>Other than that, we follow the same logic:</p><p><strong>Check if the first and last elements are the same, then we call the elements + 2 (which is the length of the first and last which is two) in between the first and last and check if it is palindrome. If the first and last are not the same, then we pass it as two possible substrings: one removing the first element and second removing the last element, and check if any subsequence forms a palindrome.</strong></p><p>Here’s the code for reference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*phNrCiXgB1eJ82JRtxgXcg.png" /></figure><h3>GitHub and Self Project</h3><p>I am not doing apptitute since there is a screenign test in our collage for placements i have to prepare some question since i am little to no good in aptitute 😕</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=348de615dfd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[9/365 Days to Crack GSoC / Job — A Daily Grind Log]]></title>
            <link>https://medium.com/@leonjasonsanto/9-365-days-to-crack-gsoc-job-a-daily-grind-log-02ddbb2d970d?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/02ddbb2d970d</guid>
            <category><![CDATA[grind]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 01:56:14 GMT</pubDate>
            <atom:updated>2025-07-15T01:56:14.728Z</atom:updated>
            <content:encoded><![CDATA[<h3>9/365 Days to Crack GSoC / Job — A Daily Grind Log</h3><p>This is day 9 of the grind in doing the GSoC/Job grind. Having a goal set makes me work for it in a more structured way. The grind consists of three things: LeetCode, GitHub, and self-projects.</p><h3>LEETCODE</h3><p>Today’s LeetCode is 647. Palindromic Substrings that follows the <strong>DP on strings pattern</strong>. Previously, I’ve covered what to do if there are two strings, now what if there is only one input? Let’s do the question!</p><h3>647. Palindromic Substrings</h3><p><strong>Problem statement:</strong> Given a string s, we have to return the number of palindromic substrings in it.</p><p>This problem feels quite different and same at the same time. All we have to do is go through all the combinations and check for palindrome like brute force, but there is one simple analogy that makes it a little different.</p><p>Consider a string “abba”. If you want to check if the string is palindrome, you just have to check the first and last element, and for the remaining elements we’d give it to the dp to get the previously computed result.</p><h3>Top-down Approach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*zvRjr6BQfIw6q6btpOdAbw.png" /></figure><h3>op-down Approach</h3><p>For more understanding, see the code at the end. In the top-down approach, we go through all possible substrings same as brute force and create a recursive solution, but including the dp (memoization) makes the solution pass.</p><p>Here’s the code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XHY5DAlAzjvPL4ecqiASTw.png" /></figure><p>The n² loop I used is quite different because it is a simple optimization done by me. If we use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dR5pGG43iScIcnuLqo19FA.png" /></figure><p>I believe method one is more efficient because in this method, for every substring, the previous is already computed as it goes from bottom. Though it’s a subtle improvement, I thought it makes it better. The 2nd one maybe good to use because of better readability.</p><p><strong>Bottom top approach</strong></p><p>Here we build from bottom as the name suggests. We start from individual characters a, b, c, d and compute it, and it gives one for each since single characters are always palindromes, and it is stored in dp.</p><p>Same goes for the next level: ab, bb, ba, and it is stored. If first and last elements are the same, like that we go for every combination. But when we reach lengths after 2 (like say &quot;aba&quot;), we check if first and last element a==a, and we will check if the elements other than first and last form a palindrome, then it gives the result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*NDw5qTNhssx21Ln2hvI2-Q.png" /></figure><p>Heres the code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*EzenZk72ciNdufNapaY1RQ.png" /></figure><p><strong>Github <br></strong>I’ve somewhat understood what the issue is — it’s more like a small feature request. All I have to do is create a new bot that uses ChatGPT wrapper. Whenever it triggers, it should give a summary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vVsgOE4UCwz4rkqUYrbDxA.png" /></figure><p>Now I somewhat understand what should be the input and output types. Since this repo is not our everyday normal repo and uses healthcare data, the data should be secure. So they follow something called FHIR method because of several reasons:</p><ol><li><strong>FHIR is feasible and consistent</strong> — Many healthcare businesses switch or migrate their tech stacks in search of new features, but it might support the new feature while not supporting other necessary features. It might have less frequent updates, but FHIR is consistent over years and doesn’t cause the cost of migrations.</li><li><strong>We use it because of FHIR characteristics</strong> — FHIR can extend normal CRUD operations. Normally our CRUD operations are built for simple fetching and some business logic, but healthcare has a lot of resources and data types for safety which might make us take 10s or more of different data or resources and do operations on them. On some we may delete and some we may create. What FHIR allows is that it extends these CRUD operations and gives a lot of resource operations to do operations and can have support for creating custom FHIR requests. Basically, it’s like we can edit different requests to our will with a lot of given resources specifically tailored for healthcare like Medplum.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1jEeP7RWOhJ4UVuM5G_DgQ.png" /></figure><p>See, the request and return types are different. This is a dummy jargon I’ve written — still there are a lot of mistakes to correct and I want to understand how they deal with other bots. They have separate types for request and response: FhirRequest and FhirResponse. There are still a lot of jargons that are yet to be understood.</p><p><strong>Self Project<br>no self proj today</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02ddbb2d970d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[8/365 Days to Crack GSoC / Job — A Daily Grind Log]]></title>
            <link>https://medium.com/@leonjasonsanto/8-365-days-to-crack-gsoc-job-a-daily-grind-log-850488d8a5e6?source=rss-51f89327b30c------2</link>
            <guid isPermaLink="false">https://medium.com/p/850488d8a5e6</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[grind]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[lambochin]]></dc:creator>
            <pubDate>Sun, 13 Jul 2025 16:31:39 GMT</pubDate>
            <atom:updated>2025-07-13T16:31:39.985Z</atom:updated>
            <content:encoded><![CDATA[<h3>8/365 Days to Crack GSoC / Job — A Daily Grind Log</h3><p>Today is day 8 of doing the grind having to land a job or crack GSOC next year</p><p>Today let’s touch on a sub-pattern of the DP pattern itself, i.e., DP on strings. I’ve done 3 patterns so far:</p><p><strong>1)</strong> Minimum (Maximum) Path to Reach a Target (I haven’t covered this in my articles) <strong>2)</strong> Distinct Ways <strong>3)</strong> Merging Intervals</p><p>And this is the 4th pattern which we are going to cover. Let’s get started!</p><h3>General Problem in this pattern</h3><p>There are two ways the problem can be asked in this pattern: One is by giving two strings expecting a result, or giving one string and expecting a result.</p><p>I mentioned an example for each of the ways in which the problem can be asked, so let’s do the scenario in which there are two strings and it asks us to return a result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*MtcjVusXSSrxUAUeb-W3lQ.png" /></figure><h3>Longest Common Subsequence</h3><p><strong>Problem statement:</strong> Given two strings, get the maximum common subsequence. A subsequence is a group of elements in the given string where order does not matter in the subsequence. There are two approaches in which this can be solved (top-down and bottom-up).</p><h3>1) Top-down</h3><p>Let us take an example string “ace” and “abide” (I’ve given this as an image).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*ra6tyHAi8zelfziW8RSRlg.png" /></figure><p>Here we start from the first element in the string. Initially, we have two indices: one for text1 and one for text2. We start from 0,0. We have two options:</p><ol><li>If the elements are the same -&gt; call it by increasing the pointer by 1 for both i and j, i.e., i+1, j+1</li><li>If there are different elements then -&gt; call the function by increasing the i pointer by 1 or j by 1 and getting the max out of the two</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*ABWm_NMZrHZ2M71B0xbmVA.png" /></figure><p>There is one base case for this problem: that is when we exceed the length of any of the inputs. Here’s the code where I also applied the optimization:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8LwfiyBYtELQjIYX4baJgA.png" /></figure><p><strong>Bottom top approaches</strong></p><h3>2) Bottom-up approach</h3><p>Here in the bottom-up approach, we check every possible sequence between the two texts and we build from bottom for every element. Let’s consider the same example as before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*G7YQ-Twjh1yYMSaPp5335Q.png" /></figure><p>Here we slowly build up from zero for every element combination. For every element combination we have two takeaways:</p><ol><li>If the element in text1 and text2 are the same (say we have “abc” in text2 and “ac” in text1, the ‘c’ in “abc” and “ac” is the same, so we are computing the combination [2][3]. All we have to do is add 1 along with the previously computed value, i.e., the value for “ab” in text2 and “a” in text1). We will get the value.</li></ol><p>Here’s the code for that approach:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*26xbVUgabSX4LviUwLsg-w.png" /></figure><h3><strong>Github</strong></h3><p>I wil try to create a AWS lambda instance using my acc and check and understand how creatino of bot’s works in this medplum repo and will update soon .Before that why not understand how aws lambda work like architecture and ir will be interesting .I somewhat got a gist of what happening in the repo and i will try to run this repo locally</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=850488d8a5e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>