<?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 Balaji R on Medium]]></title>
        <description><![CDATA[Stories by Balaji R on Medium]]></description>
        <link>https://medium.com/@balajiramavathu12?source=rss-df24325177e7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6tMub873XWsyrvc7-bbGSw.jpeg</url>
            <title>Stories by Balaji R on Medium</title>
            <link>https://medium.com/@balajiramavathu12?source=rss-df24325177e7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 07:00:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@balajiramavathu12/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[Maximum Subarray: Kadane’s Algorithm]]></title>
            <link>https://medium.com/@balajiramavathu12/coding-patterns-kadanes-algorithm-67aa94cb056b?source=rss-df24325177e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/67aa94cb056b</guid>
            <category><![CDATA[kadanes-algorithm]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[maximum-subarray]]></category>
            <category><![CDATA[coding-patterns]]></category>
            <category><![CDATA[competitive-programming]]></category>
            <dc:creator><![CDATA[Balaji R]]></dc:creator>
            <pubDate>Tue, 02 May 2023 11:42:51 GMT</pubDate>
            <atom:updated>2023-05-02T15:16:25.235Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey there, folks! Today we’re going to talk about Kadane’s algorithm, a nifty little trick for finding the maximum subarray sum in an array. If you’re a fan of dynamic programming, you’re going to love this one.</p><h3>Kadane’s Algorithm Explained</h3><p>So, how does it work? Well, it’s pretty simple, actually.</p><ul><li>We start by initializing two variables: <em>maxSoFar</em> and <em>maxEndingHere</em>. <em>maxSoFar</em> keeps track of the maximum subarray sum we’ve seen so far, and <em>maxEndingHere</em> keeps track of the maximum subarray sum that ends at the current position in the array.</li><li>Then, we loop over the array and do a little dance. For each element in the array, we update <em>maxEndingHere</em> to be the maximum of the current element and the sum of the previous <em>maxEndingHere</em> and the current element.</li></ul><blockquote>In other words, we’re asking ourselves: “is it better to start a new subarray at this element, or to add this element to the subarray that ended at the previous element?”</blockquote><ul><li>Once we’ve updated <em>maxEndingHere</em>, we compare it to <em>maxSoFar and </em>update <em>maxSoFar</em> if <em>maxEndingHere</em> is greater. This means that we’ve found a new maximum subarray sum.</li></ul><p>And that’s it! Once we’ve looped over the entire array, we return <em>maxSoFar</em> and pat ourselves on the back for a job well done.</p><p>Let’s take a look at an example to see how it all fits together. We’ll start with this array:</p><pre>nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4]</pre><p>We start by setting <em>maxSoFar </em>and <em>maxEndingHere </em>to -2, which is the first element of the array. Then we loop over the rest of the array and do our little dance:</p><ul><li>For the second element (1), we update <em>maxEndingHere </em>to be the maximum of 1 and -2 + 1, which is 1.</li><li>For the third element (-3), we update <em>maxEndingHere </em>to be the maximum of -3 and 1–3, which is -2.</li><li>For the fourth element (4), we update <em>maxEndingHere </em>to be the maximum of 4 and -2 + 4, which is 4.</li><li>And so on.</li></ul><p>At the end of the loop, <em>maxSoFar </em>is 6, which is the maximum subarray sum in the array. Pretty cool, huh?</p><p>Now, you might be wondering: “What if the array has only negative numbers?” Well, fear not, my friend! Kadane’s algorithm can handle that too. Let’s take a look at this array:</p><pre>nums = [-5, -2, -3, -1, -4]</pre><p>We start by setting <em>maxSoFar</em> and <em>maxEndingHere</em> to -5, which is the first element of the array. Then we loop over the rest of the array and do our little dance:</p><ul><li>For the second element (-2), we update <em>maxEndingHere</em> to be the maximum of -2 and -5–2, which is -2.</li><li>For the third element (-3), we update <em>maxEndingHere</em> to be the maximum of -3 and -2–3, which is -3.</li><li>And so on.</li></ul><p>At the end of the loop, <em>maxSoFar</em> is -1, which is the maximum subarray sum in the array.</p><h3>Final implementation of the algorithm (in Kotlin) :</h3><pre>fun maxSubArray(nums: IntArray): IntArray {<br>    var maxSoFar = nums[0]<br>    var maxEndingHere = nums[0]<br>    var start = 0<br>    var end = 0<br>    var newStart = 0<br>    for (i in 1 until nums.size) {<br>        if (nums[i] &gt; maxEndingHere + nums[i]) {<br>            newStart = i<br>            maxEndingHere = nums[i]<br>        } else {<br>            maxEndingHere += nums[i]<br>        }<br>        if (maxEndingHere &gt; maxSoFar) {<br>            maxSoFar = maxEndingHere<br>            start = newStart<br>            end = i<br>        }<br>    }<br>    return nums.slice(start..end).toIntArray()<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67aa94cb056b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I got selected for GSoC 2019]]></title>
            <link>https://medium.com/@balajiramavathu12/how-i-got-selected-for-gsoc-2019-75298b3e66ae?source=rss-df24325177e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/75298b3e66ae</guid>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[amahi]]></category>
            <category><![CDATA[gsoc-2019]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <dc:creator><![CDATA[Balaji R]]></dc:creator>
            <pubDate>Fri, 24 May 2019 10:53:30 GMT</pubDate>
            <atom:updated>2019-05-28T18:43:50.189Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4e68uHCQeEwZctHT0708KA.jpeg" /></figure><p>My journey for GSoC started from the first day of this year, i.e. on 1st January, 2019. From that day to the final result day, i.e. 6th May, 2019 it was definitely one hell of a ride! In this post, I am going to share my journey from a novice Android Developer to GSoC student developer in 5 months.</p><h3>A little about myself:</h3><p>Currently, I have finished my third year of B.Tech I.T course at IIIT Allahabad. When I got into the college, I literally didn’t have any knowledge about programming. But all the time, I was so curious about smartphones and android apps. It all started when I attended a workshop on Android app development that was held at my college. There I learnt about the whole workflow of building Android apps, the Android OS architecture and I found it very interesting. So I started building some basic apps as a hobby. I improved my Android skills gradually and reached an intermediate level. Then I realised, as I love the work so much, why not make it as my career. So I thought to find a way that can prove my skills.</p><p>I did some research on how I can improve my Android development skills and on the way, I got to know about GSoC and how it can help my learning curve to take off. So I decided to work on getting selected for this year’s GSoC.</p><h3>January:</h3><p>I went through previously selected organisations searching for Android based projects and discovered this very interesting organisation, Open Food Facts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*yCZn8LwvRyi70HPWJsPAMg.png" /></figure><p>It can be described as the Wikipedia for Food products. So, I started contributing to the android project and made some decent contributions by solving issues and fixing bugs in the app.</p><h3>February:</h3><p>I continued my contributions for the first half month and took a break for my Mid semester exams. By then, I have 16 merged PRs and some code reviews.</p><p>On 26th February, the results of the selected organisations came out. Unfortunately, Open Food Facts didn’t get selected this year for GSoC. I didn’t see that coming. Though I loved contributing to that project, I wanted to get selected to this year’s GSoC, so I decided to contribute to any of the other selected organisations.</p><h3>March:</h3><p>I tried my hands on some other projects but none of them seemed interesting to me. Then I came across this amazing organisation, Amahi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*s6wFht-jYqgSAgZJsJ3D-g.jpeg" /></figure><p>I learnt about their idea and it really got my interest. So, I started contributing to the Amahi android project. I made some contributions and also worked to setup my own Amahi server. Though it took me 3 days to understand and make it to work properly, it was worth it since it unlocked the whole working of the networking side of Amahi.</p><p>Meanwhile the student application process started on March 25th and by that time, I got a clear view of how I can improve the project and got a good grip on the codebase. Then I started working on my proposal.</p><h3>April:</h3><p>I wrote and submitted my proposal, it took me 4–5 days to make a decent proposal. Then I continued solving bugs and adding some features to the app, alongside the preparation for my End semester exams.</p><h3>May:</h3><p>Finally, after a long wait, results were out on May 6th night at 11:30 PM, and yeah, I made it! I got selected for GSoC 2019 with Amahi !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*swL6dyh8nTTbh3PcOSl_Aw.jpeg" /></figure><p>All of a sudden, lots of wishes and celebrations popped out and it took sometime for me to believe that I achieved it :)</p><h3>Conclusion:</h3><p>Currently, I am in the phase of Community bonding and cannot wait for the amazing experience ahead! This is my first ever blog post and as there’s a long way to go, I am going to write a series of the upcoming phases of my GSoC journey. So stay tuned! And don’t forget to use the following links to know more about me and progress of my project :)</p><p><a href="https://github.com/balaji-ramavathu">Github</a> | <a href="https://www.linkedin.com/in/balaji-r-748487153/">LinkedIn</a> | <a href="/service/mailto:balajiramavathu12@gmail.com">Email</a></p><figure><a href="https://usejournal.com/?utm_source=medium.com&amp;utm_medium=noteworthy_blog&amp;utm_campaign=tech&amp;utm_content=guest_post_image"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYxBP_WV7LI6zc-zdUkNqQ.png" /></a></figure><p>📝 Read this story later in <a href="https://blog.usejournal.com/r/?url=https%3A%2F%2Fusejournal.com%2F%3Futm_source%3Dmedium.com%26utm_medium%3Dnoteworthy_blog%26utm_campaign%3Dtech%26utm_content%3Dguest_post_read_later_text">Journal</a>.</p><p>👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. <a href="https://blog.usejournal.com/r/?url=https%3A%2F%2Fusejournal.com%2Fnewsletter%2Fnoteworthy-in-tech%2F%3Futm_source%3Dmedium.com%26utm_medium%3Dnoteworthy_blog%26utm_campaign%3Dtech%26utm_content%3Dguest_post_text">Read the Noteworthy in Tech newsletter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75298b3e66ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>