<?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 Sriram Reddy on Medium]]></title>
        <description><![CDATA[Stories by Sriram Reddy on Medium]]></description>
        <link>https://medium.com/@sriramrknp82?source=rss-bd337328e450------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tUecLyzPZwwtq1Cgk03_wQ.jpeg</url>
            <title>Stories by Sriram Reddy on Medium</title>
            <link>https://medium.com/@sriramrknp82?source=rss-bd337328e450------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:30:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sriramrknp82/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[C++ accumulate() Function]]></title>
            <link>https://medium.com/@sriramrknp82/c-accumulate-function-62465cad666b?source=rss-bd337328e450------2</link>
            <guid isPermaLink="false">https://medium.com/p/62465cad666b</guid>
            <category><![CDATA[c-plus-plus-language]]></category>
            <category><![CDATA[better-ways]]></category>
            <category><![CDATA[c-plus-plus-tutorial]]></category>
            <category><![CDATA[c-plus-plus-programming]]></category>
            <category><![CDATA[sum]]></category>
            <dc:creator><![CDATA[Sriram Reddy]]></dc:creator>
            <pubDate>Tue, 19 Nov 2024 07:19:46 GMT</pubDate>
            <atom:updated>2024-11-19T07:19:46.757Z</atom:updated>
            <content:encoded><![CDATA[<p>Computes the sum of the value of <strong><em>init</em></strong> and elements in the range [<strong><em>first, last).</em></strong></p><h3>Parameters</h3><p><strong><em>first, last — </em></strong>the range of elements to sum</p><p><strong><em>init</em></strong> — initial value of the sum</p><p><strong><em>op-binary</em></strong> operation function object that will be applied.</p><h3>Possible implementation</h3><p><a href="https://en.cppreference.com/w/cpp/algorithm/accumulate#Version_1"><strong>accumulate (1)</strong></a></p><pre>template&lt;class InputIt, class T&gt;<br>constexpr // since C++20<br>T accumulate(InputIt first, InputIt last, T init)<br>{<br>    for (; first != last; ++first)<br>        init = std::move(init) + *first; // std::move since C++20<br> <br>    return init;<br>}</pre><p><a href="https://en.cppreference.com/w/cpp/algorithm/accumulate#Version_2">accumulate (2)</a></p><pre>template&lt;class InputIt, class T, class BinaryOperation&gt;<br>constexpr // since C++20<br>T accumulate(InputIt first, InputIt last, T init, BinaryOperation op)<br>{<br>    for (; first != last; ++first)<br>        init = op(std::move(init), *first); // std::move since C++20<br> <br>    return init;<br>}</pre><h3>Example</h3><p>Note: accumulate is left-fold</p><pre>#include &lt;functional&gt;<br>#include &lt;iostream&gt;<br>#include &lt;numeric&gt;<br>#include &lt;string&gt;<br>#include &lt;vector&gt;<br> <br>int main()<br>{<br>    std::vector&lt;int&gt; v{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};<br> <br>    int sum = std::accumulate(v.begin(), v.end(), 0);<br>    int product = std::accumulate(v.begin(), v.end(), 1, std::multiplies&lt;int&gt;());<br> <br>    auto dash_fold = [](std::string a, int b)<br>    {<br>        return std::move(a) + &#39;-&#39; + std::to_string(b);<br>    };<br> <br>    std::string s = std::accumulate(std::next(v.begin()), v.end(),<br>                                    std::to_string(v[0]), // start with first element<br>                                    dash_fold);<br> <br>    // Right fold using reverse iterators<br>    std::string rs = std::accumulate(std::next(v.rbegin()), v.rend(),<br>                                     std::to_string(v.back()), // start with last element<br>                                     dash_fold);<br> <br>    std::cout &lt;&lt; &quot;sum: &quot; &lt;&lt; sum &lt;&lt; &#39;\n&#39;<br>              &lt;&lt; &quot;product: &quot; &lt;&lt; product &lt;&lt; &#39;\n&#39;<br>              &lt;&lt; &quot;dash-separated string: &quot; &lt;&lt; s &lt;&lt; &#39;\n&#39;<br>              &lt;&lt; &quot;dash-separated string (right-folded): &quot; &lt;&lt; rs &lt;&lt; &#39;\n&#39;;<br>}</pre><p>Output:</p><pre>sum: 55<br>product: 3628800<br>dash-separated string: 1-2-3-4-5-6-7-8-9-10<br>dash-separated string (right-folded): 10-9-8-7-6-5-4-3-2-1</pre><h3><strong>Example — 2</strong></h3><pre>// accumulate example<br>#include &lt;iostream&gt;     // std::cout<br>#include &lt;functional&gt;   // std::minus<br>#include &lt;numeric&gt;      // std::accumulate<br><br>int myfunction (int x, int y) {return x+2*y;}<br>struct myclass {<br> int operator()(int x, int y) {return x+3*y;}<br>} myobject;<br><br>int main () {<br>  int init = 100;<br>  int numbers[] = {10,20,30};<br><br>  std::cout &lt;&lt; &quot;using default accumulate: &quot;;<br>  std::cout &lt;&lt; std::accumulate(numbers,numbers+3,init);<br>  std::cout &lt;&lt; &#39;\n&#39;;<br><br>  std::cout &lt;&lt; &quot;using functional&#39;s minus: &quot;;<br>  std::cout &lt;&lt; std::accumulate (numbers, numbers+3, init, std::minus&lt;int&gt;());<br>  std::cout &lt;&lt; &#39;\n&#39;;<br><br>  std::cout &lt;&lt; &quot;using custom function: &quot;;<br>  std::cout &lt;&lt; std::accumulate (numbers, numbers+3, init, myfunction);<br>  std::cout &lt;&lt; &#39;\n&#39;;<br><br>  std::cout &lt;&lt; &quot;using custom object: &quot;;<br>  std::cout &lt;&lt; std::accumulate (numbers, numbers+3, init, myobject);<br>  std::cout &lt;&lt; &#39;\n&#39;;<br><br>  return 0;<br>}</pre><p>Output:</p><pre>using default accumulate: 160<br>using functionals minus: 40<br>using custom function: 220<br>using custom object: 280</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62465cad666b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quit Social Media]]></title>
            <link>https://medium.com/@sriramrknp82/hello-guys-74dee499215a?source=rss-bd337328e450------2</link>
            <guid isPermaLink="false">https://medium.com/p/74dee499215a</guid>
            <category><![CDATA[education]]></category>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[mental-health]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[youth-empowerment]]></category>
            <dc:creator><![CDATA[Sriram Reddy]]></dc:creator>
            <pubDate>Tue, 16 Jul 2024 07:23:48 GMT</pubDate>
            <atom:updated>2024-07-16T07:27:47.528Z</atom:updated>
            <content:encoded><![CDATA[<p>Quit Social Media 🫨</p><p>Hello guys,</p><p>I have been observing me from past few days and I was into social media involuntarily.</p><p>How much involuntarily is,</p><p>I have an exam to prepare, but am into social media.</p><p>I have a lot of things to do, but am into social media.</p><p>I have lot of things to learn, but am into social media.</p><p>I have many other options in my phone, but am into social media.</p><p>There&#39;s a lot of things to explore, but am into social media.</p><p>...</p><p>People over there are working hard to become the best version of themselves, but me on social media right from the movement of waking up till late at night.</p><p>How much involuntarily is - if there&#39;s a few min of time, my hands don&#39;t want to do any kind of work that is useful, instead open social media involuntarily.</p><p>Is it same to all?</p><p>I have seen people using social media like an addiction</p><p>1. To forget the situation they are in (like drinking alcohol or any kind of that),</p><p>2. To escape from the emotions they are in,</p><p>3. Some use to take break from their day to day life,</p><p>4. Some use to create,</p><p>And it goes....</p><p>It&#39;s not like me making myself or anyone low, but questioning myself, trying to know myself, figuring out me, fixing my mental health...</p><p>Lemme hear a few words from you.</p><p>In the end, &quot;Don&#39;t make social media rule you!&quot;.</p><p>Signing off,</p><p>Sriram Reddy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74dee499215a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[KLA Interview Experience for SDE Summer Internship (On-Campus) 2023]]></title>
            <link>https://medium.com/@sriramrknp82/kla-interview-experience-for-sde-summer-internship-on-campus-2023-b0645f2749ec?source=rss-bd337328e450------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0645f2749ec</guid>
            <category><![CDATA[on-campus]]></category>
            <category><![CDATA[interview-experience]]></category>
            <category><![CDATA[kla-tencor]]></category>
            <category><![CDATA[software-developer]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Sriram Reddy]]></dc:creator>
            <pubDate>Thu, 23 Feb 2023 05:46:50 GMT</pubDate>
            <atom:updated>2023-02-23T05:46:50.890Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>KLA Software Engineer Summer Intern — 2023</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PlSFP_AoLx5aZ4tmIgOXog.jpeg" /></figure><h3>First Round (Coding Round):</h3><ul><li>There are two questions in this round and the time given is 90 min, which is conducted in HackerRank.</li><li>The first question was like a standard question based on the BFS, but there are some more glitches added.</li><li>The first question in brief: there is a 2D matrix filled with 1s, 0s, and walls. Given a start and destination indices where you have to tell whether a person can able to reach the destination from the start. The person can travel in any of the 4 directions. Also, he can break the wall if he visits the wall at least twice, now the wall will become the way which is 1. Where 1 means the way, and 0 means no way.</li><li>The second question in brief: I guess no logic is needed for this just solve according to the given question. (Unfortunately, I haven’t solved this fully but solved it partially — made a simple mistake) this question is for 40 pints.</li></ul><p><strong>Tips:</strong></p><ul><li>Watch the Striver graph playlist on YouTube. The first question carries 160 points. <em>I </em>have fully solved this in the first 40 min.</li><li>You had to know C++ STL for question two.</li></ul><p>I got selected for the next round. Few people who did the second question fully and partially the 1st also got selected. From our class, 25 members were selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTRAKgIQN0j7dlXYeAMa6Q.jpeg" /></figure><h3>Round two (in-person workshop):</h3><p>Round 2 is an in-person workshop that is conducted in their office.</p><ul><li>After having breakfast at the office, the workshop started at 9 am.</li><li>They explained the problem statement and assigned a mentor for each of the 5 members (not a team-based one).</li><li>There were 7 milestones in the problem. Each milestone is linked with the other. It is an open book workshop and the mentors and the staff were so friendly and so kind to us.</li><li>It went until 5:30 pm, and 7 members were selected.</li></ul><p>I couldn’t make it in round 2. But this is a wonderful experience for a person like me since this was my first in-person workshop.<br>Thanks, KLA.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0645f2749ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>