<?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 Pranay Kothapalli on Medium]]></title>
        <description><![CDATA[Stories by Pranay Kothapalli on Medium]]></description>
        <link>https://medium.com/@pranaykothapalli?source=rss-e4e05b1dd345------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*FsCyeVe_Vn-dWUSW.</url>
            <title>Stories by Pranay Kothapalli on Medium</title>
            <link>https://medium.com/@pranaykothapalli?source=rss-e4e05b1dd345------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 23:42:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pranaykothapalli/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[How to get your VS Code to lint your JS code on-save once and for all]]></title>
            <link>https://medium.com/@pranaykothapalli/how-to-get-your-vs-code-to-lint-your-js-code-on-save-once-and-for-all-2ffd196d470b?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ffd196d470b</guid>
            <category><![CDATA[eslint]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-development]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Thu, 20 Feb 2020 04:27:34 GMT</pubDate>
            <atom:updated>2020-02-20T04:27:34.906Z</atom:updated>
            <content:encoded><![CDATA[<p>Whenever I switch my computers and I haven’t configured my editors, I always had to scour through tonnes of links on StackOverflow, GitHub issues, etc. To find the right configuration for my editor so my code always lints and I can avoid bad comments on my PRs from colleagues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*SpqrE8ritRZjwuQn" /></figure><pre><em>&quot;editor.codeActionsOnSave&quot;</em>: {<br><em>    &quot;source.fixAll.eslint&quot;</em>: true<br>}</pre><p>I’m writing this here so it acts as a guide for me next time I configure my editor. If it helps anyone else I’d be happier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ffd196d470b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Algorithm(Beginner) — Linear Search, search for a number in an array returning it’s index.]]></title>
            <link>https://medium.com/@pranaykothapalli/algorithm-beginner-linear-search-search-for-a-number-in-an-array-returning-its-index-19c492867a8e?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/19c492867a8e</guid>
            <category><![CDATA[math]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[data-structures]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Tue, 11 Dec 2018 11:03:35 GMT</pubDate>
            <atom:updated>2018-12-11T11:03:35.863Z</atom:updated>
            <content:encoded><![CDATA[<h3>Algorithm(Beginner) — Linear Search, search for a number in an array returning it’s index.</h3><h3>Question</h3><pre>Given an array <strong><em>arr </em></strong>and a number <strong><em>N</em></strong>, find the index of <strong><em>N</em></strong> in <strong><em>arr</em></strong> and return it&#39;s index. The index must be it&#39;s first occurence. If the number isn&#39;t found, just return <em>NOT_FOUND</em></pre><pre>As a bonus, you may also return the last occurence of the number <strong><em>N</em></strong>.<br>If you want to push yourself further, return an array of indices of occurences of the number.</pre><h3>Solution Ahead</h3><p>The solution to this is pretty straightforward, you may loop through the array from the beginning, stop and return when the found number is encountered.<br>If the loop is finished, you may return “NOT_FOUND” if it’s not encountered.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0556981767c7108f53f963a54939931f/href">https://medium.com/media/0556981767c7108f53f963a54939931f/href</a></iframe><p>Let me know in the comments if you tried solving this challenge. If you have a better way to do this, go ahead and post a link to your solution and lets discuss! Hope you enjoyed reading (and coding)! <br>Follow me if you’d want to keep updated with more challenges.</p><p>If you want to explore a list of more Algorithms and CS stuff, head over to <a href="https://www.awelgorithms.com/">Awelgorithms</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19c492867a8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Algorithm (Beginner) — Shuffle Algorithm]]></title>
            <link>https://medium.com/@pranaykothapalli/algorithm-beginner-shuffle-algorithm-a709747283cc?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/a709747283cc</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[sorting-algorithms]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Sat, 08 Dec 2018 17:03:44 GMT</pubDate>
            <atom:updated>2018-12-08T17:03:44.564Z</atom:updated>
            <content:encoded><![CDATA[<h3>Algorithm (Beginner) — Shuffle Algorithm</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*JFIkSGWnOWB-C8CAnEIbGw.jpeg" /></figure><p>If you’ve ever been bored of listening to songs in an order on your phone and have ever used the shuffle feature to change the order of the songs, you’ve used a variant of a shuffle algorithm.</p><p>I’ve used this algorithm to add an eye candy effect on my <a href="https://www.awelgorithms.com/home">blog</a>, you can see the letters shuffle and dance when you hover over the list items.</p><p>Implementing the shuffle algorithm is pretty fun. Here’s your challenge for today.</p><p><strong>INPUT:</strong></p><p>An array of numbers</p><pre>[1,2,3,4,5,6,7,8,9]</pre><p><strong>OUTPUT: <br></strong>An array of randomized(shuffled) numbers different from the input.</p><pre>[7,9,8,1,4,3,2,5,6]</pre><p><strong>NOTE:</strong> The most accurate shuffle algorithm is the one that is always random, you could write an algorithm that rearranges the numbers in a specific order depending on the input length or whatever. There are more than one ways to shuffle numbers. I will write a simple implementation of a shuffle algorithm which is also my favorite in this post.</p><h3>Solution Ahead</h3><p>The key is to get the total input count of numbers your function gets</p><ul><li>Keep generating random numbers from <strong><em>0</em></strong> to <strong><em>N</em></strong></li><li>Now that you have the random number between <strong><em>0</em></strong> and <strong><em>N</em></strong>, let&#39;s call it <strong><em>i. </em></strong>Now pick the number at index <strong><em>i</em></strong>. Swap it with <strong><em>0</em></strong>.</li><li>And, that’s it, keep repeating this til <strong><em>N</em></strong> is reached.</li></ul><pre>1 2 3 4 5 6 7 8 9<br> // Generate a random number between 0 and N<br> // say i is 4, swap 4 with 1<br>1 2 3 4 5 6 7 8 9<br>&lt;-----&gt;</pre><pre>4 2 3 1 5 6 7 8 9<br> // Now generate a random number between 1 and N<br> // swap the resulting index number with 1<br> // Repeat</pre><pre>4 1 3 2 6 5 9 7 8<br>// Your output will be a shuffled </pre><p>The array after the algorithm finishes running is now shuffled.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d346522f583c6297af863d3cb870d0ce/href">https://medium.com/media/d346522f583c6297af863d3cb870d0ce/href</a></iframe><p>Let me know in the comments if you tried solving this challenge. If you have a better way to do this, go ahead and post a link to your solution and lets discuss! Hope you enjoyed reading (and coding)! <br>Follow me if you’d want to keep updated with more challenges.</p><p>If you want to explore a list of more Algorithms and CS stuff, head over to <a href="https://www.awelgorithms.com/">Awelgorithms</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a709747283cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Algorithm (Beginner) — Math- Get Nth element of an Arithmetic Progression(AP)]]></title>
            <link>https://medium.com/@pranaykothapalli/algorithm-beginner-math-get-nth-element-of-an-arithmetic-progression-ap-e14551bd2eaf?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/e14551bd2eaf</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Thu, 06 Dec 2018 08:52:22 GMT</pubDate>
            <atom:updated>2018-12-06T08:52:22.297Z</atom:updated>
            <content:encoded><![CDATA[<h3><a href="https://medium.com/p/3d5ae7c8c068?source=your_stories_page---------------------------">Algorithm (Beginner) — Math- Get Nth element of an Arithmetic Progression(AP)</a></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pt74qPacebt3Mgi1q2HOg.jpeg" /></figure><p>Write a function/algorithm that takes in —</p><p>Need a refresher for <a href="https://medium.com/@pranaykothapalli/math-arithmetic-progression-revisited-61e9e196d49c">Arithmetic Progression</a>?</p><p><strong>INPUT</strong><br>- The first element of an Arithmetic Series —<strong><em> a<br></em></strong>- The difference - <strong><em>d </em></strong>of the AP<br>- <strong><em>N</em></strong> as the Nth number of the AP</p><p><strong>OUTPUT: <em>Nth</em> </strong>element in the AP</p><h3>Solution Ahead</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/58ef6f9be48c427a330429b93f1a6b57/href">https://medium.com/media/58ef6f9be48c427a330429b93f1a6b57/href</a></iframe><p>Let me know in the comments if you tried solving this challenge. If you have a better way to do this, go ahead and post a link to your solution and lets discuss! Hope you enjoyed reading (and coding)! <br>Follow me if you’d want to keep updated with more challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e14551bd2eaf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Algorithm (Beginner) — Math- Check if the series input is an Arithmetic Progression(AP)]]></title>
            <link>https://medium.com/@pranaykothapalli/algorithm-beginner-math-check-if-the-series-input-is-an-arithmetic-progression-ap-3d5ae7c8c068?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d5ae7c8c068</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[math]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[mathematics]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Wed, 05 Dec 2018 13:19:03 GMT</pubDate>
            <atom:updated>2018-12-05T13:19:03.587Z</atom:updated>
            <content:encoded><![CDATA[<h3>Algorithm (Beginner) — Math- Check if the series input is an Arithmetic Progression(AP)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pt74qPacebt3Mgi1q2HOg.jpeg" /></figure><p>Assume you’ve been given an input of an array of integers.</p><p><strong>INPUT</strong>-</p><pre>arr = [5,9,13,17,21,25,29,33,37,41]</pre><p><strong>OUTPUT</strong> should return <strong><em>true/false</em></strong></p><p>You need to write an algorithm/function that checks if the input array is a valid AP.</p><p>Need a refresher on <a href="https://medium.com/@pranaykothapalli/math-arithmetic-progression-revisited-61e9e196d49c">Arithmetic Progression</a>? <br>Head over to <a href="https://en.wikipedia.org/wiki/Arithmetic_progression">Wikipedia</a> for extra reading.</p><h3>Solution Ahead</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5edc2562a77d5d942d018a339c1cff1/href">https://medium.com/media/c5edc2562a77d5d942d018a339c1cff1/href</a></iframe><p>Let me know in the comments if you tried solving this challenge. If you have a better way to do this, go ahead and post a link to your solution and lets discuss! Hope you enjoyed reading (and coding)! <br>Follow me if you’d want to keep updated with more challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d5ae7c8c068" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Math — Arithmetic Progression Revisited]]></title>
            <link>https://medium.com/@pranaykothapalli/math-arithmetic-progression-revisited-61e9e196d49c?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/61e9e196d49c</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[computational-thinking]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Wed, 05 Dec 2018 10:27:41 GMT</pubDate>
            <atom:updated>2018-12-06T08:53:53.993Z</atom:updated>
            <content:encoded><![CDATA[<h3>Math — Arithmetic Progression Revisited</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*bQnocnVYF4dnbwGpQqhAQA.jpeg" /></figure><p>If this were a couple of years ago, I wouldn’t be interested in writing this. I’ve realized the importance of patterns in my life as a programmer. Patterns are something a programmer must become good at in recognizing, one of those basic forms of patterns that can be represented in numbers is Arithmetic Progression.</p><p>Wikipedia defines Arithmetic Progression as “<em>an </em><strong><em>arithmetic progression </em></strong><em>(AP) or </em><strong><em>arithmetic sequence</em></strong><em> is a </em><a href="https://en.wikipedia.org/wiki/Sequence"><em>sequence</em></a><em> of </em><a href="https://en.wikipedia.org/wiki/Number"><em>numbers</em></a><em> such that the difference between the consecutive terms is constant.</em>”</p><p><strong>ELI5</strong> Let’s say you have a series of numbers, you pick any two numbers from the series — get its difference and note it down the difference(Let’s call it<em> </em><strong><em>D</em></strong>). Repeat. <br>If the difference is always <strong><em>D</em></strong>, then the series of numbers is said to be an arithmetic progression.</p><p>Let’s take a sequence —<strong><em> 5,7,9,11,13,15</em></strong><em>.</em><br>Picking any two consecutive numbers from the above sequence the difference between any two consecutive numbers will always be the same — <strong><em>D</em></strong> is 2</p><p>You can easily disqualify a series as not an A.P if the difference between any consecutive numbers is not the same.</p><p>Want to know how find out if a given series is an Arithmetic Progression? Head over to the <a href="https://medium.com/@pranaykothapalli/algorithm-beginner-math-check-if-the-series-input-is-an-arithmetic-progression-ap-3d5ae7c8c068">challenge</a>.</p><h3>Finding the N-th term of an Arithmetic Progression</h3><p>You can get the <em>n-th</em> term of the A.P by using the following formula.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/140/1*BTjHf7kizeQgw3AgoPEzSw.gif" /><figcaption>Formula: Finding the Nth term of an A.P</figcaption></figure><p>Where<strong><em> a</em></strong> is the first term of A.P<br><strong><em>n</em></strong> is the index of the number you want to find out<br><strong><em>d</em></strong> is the common difference of the A.P</p><p><a href="https://medium.com/@pranaykothapalli/algorithm-beginner-math-get-nth-element-of-an-arithmetic-progression-ap-e14551bd2eaf">Looking for a challenge to find out the N-th series of an AP?</a></p><p><strong>Note to Programmers</strong>: <em>It could benefit you one day if you know how to apply this formula and use it in your functions instead of writing an algorithm from scratch that loops through a series to find your N-th term. You don’t need to remember it, just keep in mind that you might find this formula handy and you can easily Google it when you need it.</em></p><h3>Finding the sum of Arithmetic Series</h3><p>If you summed up every number in the A.P, it will amount to a value. Since there’s a pattern in the series, thanks to the beauty of mathematics, we can derive a formula to find the sum of N numbers in an A.P.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/113/1*As4KsFaSOTlSLbL_cAcWLg.gif" /><figcaption>Formula: Sum of n numbers in A.P</figcaption></figure><p><a href="https://en.wikipedia.org/wiki/Arithmetic_progression#/media/File:Animated_proof_for_the_formula_giving_the_sum_of_the_first_integers_1%2B2%2B...%2Bn.gif">Wikipedia</a> also hosted a great animation to show the proof for the formula, which I think is demonstrated brilliantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nfb5soJ7TDWaq7tnQmX00w.gif" /></figure><h3>Finding the mean of the Arithmetic Series</h3><p>Mean of an A.P would be the addition of the first term and the last term and dividing it by 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/94/1*pivHmVHvoXn5WAf0frfQmw.gif" /><figcaption>Formula: Mean of an A.P</figcaption></figure><p>If you liked the write up and would like to be updated on future topics such as this, follow me! I write about Algorithms, Math, Software Engineering, Web.<br>My GitHub — <a href="https://github.com/kotAPI">https://github.com/kotAPI</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61e9e196d49c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Algorithm (Beginner) — Pretty Print Mathematical table]]></title>
            <link>https://medium.com/awelgorithms/algorithm-beginner-pretty-print-mathematical-table-4875835fd143?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/4875835fd143</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Tue, 04 Dec 2018 10:56:12 GMT</pubDate>
            <atom:updated>2018-12-04T10:56:12.850Z</atom:updated>
            <content:encoded><![CDATA[<h3>Algorithm (Beginner) — Pretty Print Mathematical table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmML4rBz9H0Gp4SrCF1GsQ.jpeg" /></figure><p>In Today’s challenge, you need to write a program that pretty prints a mathematical table, It’s a relatively easy task to get done- even for a total beginner. The challenge here is to use strings to print the tables in a grid-like fashion where the positions of the numbers are maintained and are easy for the eyes to read/skim through.</p><p>You’re technically pushing each of the numbers to the right to stick to an invisible wall so they look like they are in a grid of length N.</p><p>Let’s say we have a single digit number that needs to be displayed in a grid of 3. You’d imagine it to be something like this.</p><pre>[&#39;3&#39;,&#39; &#39;,&#39; &#39;]</pre><p>When in fact, you need it to be like this.</p><pre>[&#39; &#39;,&#39; &#39;,&#39;3&#39;]</pre><p>It’s a lot easier to read numbers when they float to the right as opposed to reading them from the left. That’s why we even perform multiplication in this way on a paper.</p><pre>3455534<br>x  1233<br>--------</pre><h3>Solution Ahead</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74b686f1e155379e51e5cbdc5806c09e/href">https://medium.com/media/74b686f1e155379e51e5cbdc5806c09e/href</a></iframe><p>Let me know in the comments if you tried solving this challenge. If you have a better way to do this, go ahead and post a link to your solution and let&#39;s discuss! Hope you enjoyed reading (and coding)! <br>Follow me if you’d want to keep updated with more challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4875835fd143" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awelgorithms/algorithm-beginner-pretty-print-mathematical-table-4875835fd143">Algorithm (Beginner) — Pretty Print Mathematical table</a> was originally published in <a href="https://medium.com/awelgorithms">awelgorithms</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Algorithm (Beginner)— Print the pattern — 332211]]></title>
            <link>https://medium.com/awelgorithms/algorithm-beginner-print-the-pattern-332211-753408d4b8b5?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/753408d4b8b5</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Mon, 03 Dec 2018 09:39:56 GMT</pubDate>
            <atom:updated>2018-12-03T13:22:23.515Z</atom:updated>
            <content:encoded><![CDATA[<h3>Algorithm (Beginner)— Print the pattern — 332211</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmML4rBz9H0Gp4SrCF1GsQ.jpeg" /></figure><p>For an input of N, print a pattern similar to the following,<br>For an input of 1</p><pre>1</pre><p>Should print for an input of 2-</p><pre>2211<br>21</pre><p>For an input of 3-</p><pre>3 3 3 2 2 2 1 1 1<br>3 3 2 2 1 1<br>3 2 1</pre><p>And so on..</p><p>Might look simple at first to solve this, but it is notorious and could take you more time than expected if you don’t plan your algorithm in advance. I made the mistake of not thinking in advance and it took me over 20 minutes to solve this, I wasn’t thinking beyond my primary approach. Just need an open mind to solve this.</p><p>From the above sample output, we need a loop that iterates 3 (N)times. For every iteration, we need another loop to iterate another 3 (N)times, 2 (N-1) times, 1 (N-2) times,. till the end of the loop.</p><p>Easier thing to do to store a single line to output on end of every iteration is to append to a string. If you’d like to make this even more challenging, you could operate only on integers. I’d like to see what you come up with, let me know in the comments.</p><h3>Solution Ahead</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b94b6c45a7fb09472da0f0bfcffd28a/href">https://medium.com/media/8b94b6c45a7fb09472da0f0bfcffd28a/href</a></iframe><p>Let me know in the comments if you tried solving this challenge. If you have a better way to do this, go ahead and post a link to your solution and lets discuss! Hope you enjoyed reading (and coding)! <br>Follow me if you’d want to keep updated with more challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=753408d4b8b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/awelgorithms/algorithm-beginner-print-the-pattern-332211-753408d4b8b5">Algorithm (Beginner)— Print the pattern — 332211</a> was originally published in <a href="https://medium.com/awelgorithms">awelgorithms</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I will lose it when a next start-up founder says “We’ll use AI and Machine Learning for our…]]></title>
            <link>https://medium.com/@pranaykothapalli/i-will-lose-it-when-a-next-start-up-founder-says-well-use-ai-and-machine-learning-for-our-product-54e74ea8727f?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/54e74ea8727f</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Tue, 12 Sep 2017 04:57:23 GMT</pubDate>
            <atom:updated>2017-09-12T04:57:55.655Z</atom:updated>
            <content:encoded><![CDATA[<h3>I will lose it when a next start-up founder says “We’ll use AI and Machine Learning for our product”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OOWSoWHeQ5kyJ4N0P2ptNA.png" /></figure><p>My frustration with the current start-up scene has built up over the years, It’s sad to see the field I love is getting saturated with dickheads entering this beautiful field with irrelevant backgrounds with zero passion for the technology. This is a rant on how almost every start up founder these days wants to use Machine Learning/AI for their apps.</p><p>Start-ups are booming and have become a whole new market for scammers and people who have nothing else to do, potentially risking the fate and future of genuine potential founders. What do most of these start-ups do? Oh they’re really innovative start-ups that are changing the world with ground breaking technologies , they manage how you go take a dump — it’s either an app… or a website, mostly an app- because that’s the <em>shit</em> these days(pun intended). You genuinely have a great idea and you wanna start a start-up? You’re going have a tough time and probably have to meet tonnes of people with shitty ideas who can never stop pitching their innovative idea even to an electric pole. Need an investor? Tough luck, those days are gone. Every start up founder these days have tremendous amounts of ego and feel like the next Mark Zuckerberg in the making, as if things aren’t really hard enough, they probably read a couple of tech magazines to absorb the trending words like “AI” and start using them in regular conversations with people while describing their product, or even worse- to an investor.</p><p>I will seriously lose it the next time a start up founder utters “Machine Learning/AI” just to feel self important and sound fancy just for the sake of it. My recent job hunting experience was the worst, I’ve applied to numerous start-ups in Hyderabad. There are more start-ups running today than the sheer number of bacteria in the entire galaxy! and 99.99% of them are changing the world with their innovation by using Machine Learning and AI.</p><p>I’d like to highlight one of the senseless conversations I had with a start -up founder at T-hub.</p><blockquote><strong><em>Founder</em></strong>: So, we’re crunching a lot of data about people taking dump. We need to add machine learning and AI to make our product better.</blockquote><blockquote><strong><em>Me:</em></strong> Oh… <em>(exits the room)</em></blockquote><p>Listen you piece of shit, there are so many great start ups who actually work their days and nights off to build the technology you’re using today. Your phone today has more computing power than the whole world’s computing power combined in 1970s, which you use to jack off everyday, such a shame.</p><p>Mother Fucker. You want to use Machine Learning? Do you even know what Machine Learning is ? It’s not a fucking drag and drop piece of technology that you can just “USE”. Just because you’re hearing it on the news doesn’t mean you’re remotely qualified to even think or even talk about it. You should actually go back to school and “learn” to use your brain before you teach machines how to learn. Sorry to burst your bubble, you’ll never be using these technologies for the piece of shit founder you are. These technologies are a big deal, they can only be wielded by someone skilled, who literally have dreams about these technologies when they go to sleep, who put in years of efforts studying and countless hours staying awake perfecting their craft, who will never work for you for the kind of peanuts you pay them, they’re all being absorbed by the giant companies that are actually building genuine solutions to make the world better, or at least a part of it.</p><p>If you’re someone who’s looking for a job and come across such founders who just boast about their product, use the latest fancy tech lingo to sound self important and doesn’t agree to pay you well, exit the room please. My frustration levels have lowered now that I got it all out. This is the end of my rant.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54e74ea8727f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding JavaScript ‘this’ bindings]]></title>
            <link>https://medium.com/@pranaykothapalli/understanding-javascript-this-bindings-49a1ede4dd65?source=rss-e4e05b1dd345------2</link>
            <guid isPermaLink="false">https://medium.com/p/49a1ede4dd65</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript-frameworks]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[this]]></category>
            <dc:creator><![CDATA[Pranay Kothapalli]]></dc:creator>
            <pubDate>Thu, 20 Jul 2017 09:44:23 GMT</pubDate>
            <atom:updated>2017-07-20T09:50:56.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fMDz800vMhJqXAdTxlL1bQ.jpeg" /><figcaption>‘this’ is JavaScript</figcaption></figure><p>I’ve been there, I’ve had my share of troubles in the beginning to understand what was wrong with my code, especially for a person coming from a background of family of strictly typed languages. It was tough understanding the bindings and the use of ‘this’ keyword. With time, I was able to understand the nitty-gritties of the language. This post is my attempt to reinforce myself with the things I’ve learned and explain others — the bits of the language in the best way I can.</p><h3>Implicit Binding</h3><p>In implicit binding, you can’t really tell what the result of this is going to be before hand til you know which function or operation is being invoked, the rule for this is pretty simple. To find out what your this keyword is referring to, you look to the immediate scope of the left to the dot call operation. This is the most commonly used and its probably how you already know how ‘this’ keyword operates in JavaScript, but it can get pretty confusing, so hang in there.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9f9ab77478ab2b2c2cb47a17af20c54e/href">https://medium.com/media/9f9ab77478ab2b2c2cb47a17af20c54e/href</a></iframe><p>In this case, we used ‘this’ keyword in two cases- this.name and this.age , I hope it’s pretty easy to understand, the name would be “Matt Murdock” and the age would be “28” since both of these lie in the same immediate scope of myObject and that’s what ‘this’ would be referring to. If we look to the left of the dot call operation, it is myObject.</p><p>Let’s take it up a notch. Take some time to understand what’s happening here.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/68b41650d91089e7406e86cf779a5b2c/href">https://medium.com/media/68b41650d91089e7406e86cf779a5b2c/href</a></iframe><p>If you look carefully, the two objects DonInventory and JackInventory are being called into InventoryDetails and have their own individual reference. These are two different objects referring to two different set of values. To find out which values this is referring to. Look to the left of the dot operation and find the immediate scope of that variable. In this case,</p><p>JackInventory.GetInventoryDetails() logs the name, pens, pencils by accessing the JackInventory object and their values.</p><p>A little bit of more practice won’t hurt.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/018dad33d31e595e36d87e6545ee0154/href">https://medium.com/media/018dad33d31e595e36d87e6545ee0154/href</a></iframe><p>Just similar to the above example, Company is a function that takes two arguments and returns an object. As discussed, the rule says, you need to look at the immediate scope of the object that this invoked function or object is referring to. newCompany.getNetWorth is loggingHex etc. If you noticed the one level deeper values of company2, you can see that newCompany.company.getNetWorth()&#39;s this is referring to different values compared to newCompany.getNetworth() function. Look to the left side of the dot call operator of getNetWorth()</p><h3>Explicit Binding</h3><p>//call, apply, bind</p><p>I think it’s pretty clear so far that using this in JavaScript can be messy and sometimes confusing as opposed to other strictly typed languages since there is no intrinsic relationship between the function and any of the objects, as we really don’t have classes in JavaScript. Because in JavaScript, if this doesn’t reference something, it could reference a global object, this could be dangerous. For instance,</p><pre>// someFunc:function(){<br>//    return this.x;<br>// }</pre><pre>var func = Obj.someFunc();<br>func(); // Could refer to global variable &#39;x&#39;</pre><p>I’ve had a lot of cases where this in my code referred to the window object or undefined when in strict mode. Nobody wants code that’s so unpredictable. To take full advantage of “Explicit” binding in JavaScript, you need to use the built-in call and apply methods.</p><h4>call ()</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8f6623f9dab6aec1ede757c3395633a/href">https://medium.com/media/e8f6623f9dab6aec1ede757c3395633a/href</a></iframe><p>You would want to use a call function to control the scope of the function that’s called. This allows us to write a lot of reusable code (if written correctly), you could use these functions without restricting them to a specific object. You’re typically binding this function to whatever object you want to use it with. A clearer example would be, instead of rewriting getHealth() function a hundred times for every RPG player in your game. You could write the function once and bind it with the specific object you want it to be called with in run-time and use it without any problems. It’s great to know the scope of the function before hand and less prone to errors(or worse, reference global objects).</p><h4>apply()</h4><p>this function (see what I did there?), so this function is another in-built function in JavaScript to explicitly bind a function to an object and apply the array of arguments to it, hence the name.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af63f6d1c80302538a6b820058292d95/href">https://medium.com/media/af63f6d1c80302538a6b820058292d95/href</a></iframe><p>This is same as the call function binding, but this function would be more useful if you have a long list of arguments to pass to a function. You can just pass in an array when you call the apply function. If you’ve a DOM that needs to update, instead of calling the function and individually applying them to the function and making it look something like this -</p><p>func.apply(with, so , many, arguments, that, i , lost , count, what, am , i , doing, send, help);</p><p>You could just store all of these in an array and do something like this</p><p>func.apply(myArrayOfArguments)</p><h4>bind()</h4><p>Bind is another function that is very similar to apply(), but instead of invoking the function on call, it is going to return the function so you can invoke it later when you please.</p><pre>var myInvokedFunction = func.bind(object, argument1, argument2,argument3...);</pre><p>You could later call this function by calling myInvokedFunction . Easy does it. I use this extensively in my front-end projects. Helps me know before hand if I know what data to process and use later in the programs just by calling the reference function.</p><h4>new Binding</h4><p>You’d typically use the new keyword to create new instances of objects in JavaScript that simulates the feel of classes in other languages like Java, C++ etc, even though they aren’t really classes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/035dde65c08fae7ca9fbc9ad6e9ff7f0/href">https://medium.com/media/035dde65c08fae7ca9fbc9ad6e9ff7f0/href</a></iframe><p>This is how you’d bind the new object with a function using the new keyword to create the object. Similar to the one’s you’ve seen in the above examples, I’m using the call function to bind the object to the function.</p><h4>window binding</h4><p>It’s all well and good that we’re able to understand how the binding works, although, there are a couple of red-flags when working with JavaScript, especially when not working in strict mode . If you’re not careful enough, you might be using variables that you didn’t even mean to in the first place.</p><p>Let’s modify the above example a bit.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/155688ea5a412bd05873fdb38829891b/href">https://medium.com/media/155688ea5a412bd05873fdb38829891b/href</a></iframe><p>With a few modifications of the above example, you can see the catastrophic results the code can have if you don’t bind your functions properly. In this case, the variables used wouldn’t be generally used in a normal program. But if ever, there’s a global variable with the same name of that of yours, the results can be similar to this. So be wary of referencing the global variables, always bind your functions with extra care.</p><p>I hope this post has been of some value to you and you’ve picked up something from here that you could use in the future in your development journeys. If there’s something wrong with what I just wrote, I’d love to learn and correct myself, or if you’d like to add anything, please let me know in the comments.</p><p>You can follow me over here for random dev posts, I also have a <a href="https://github.com/kotAPI">GitHub</a> if you want to stay updated on my latest projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49a1ede4dd65" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>