<?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 Shivagni Singh Rajput on Medium]]></title>
        <description><![CDATA[Stories by Shivagni Singh Rajput on Medium]]></description>
        <link>https://medium.com/@Shivagni?source=rss-2ba86f16aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZdrXtHuf3bicwbOifWL5sg.jpeg</url>
            <title>Stories by Shivagni Singh Rajput on Medium</title>
            <link>https://medium.com/@Shivagni?source=rss-2ba86f16aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 13:42:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Shivagni/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[15 Days of Learning SQL Part 1 | Hackerrank SQL Solutions]]></title>
            <link>https://medium.com/@Shivagni/15-days-of-learning-sql-part-1-hackerrank-sql-solutions-7720336303b6?source=rss-2ba86f16aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/7720336303b6</guid>
            <category><![CDATA[hackerrank]]></category>
            <category><![CDATA[mysql]]></category>
            <dc:creator><![CDATA[Shivagni Singh Rajput]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 16:04:17 GMT</pubDate>
            <atom:updated>2025-01-27T16:11:28.244Z</atom:updated>
            <content:encoded><![CDATA[<h3>Problem :</h3><p>Julia conducted a 15 days of learning SQL contest. The start date of the contest was March 01, 2016 and the end date was March 15, 2016.</p><p>Write a query to print total number of unique hackers who made at least 1 submission each day (starting on the first day of the contest), and find the hacker_id and name of the hacker who made maximum number of submissions each day. If more than one such hacker has a maximum number of submissions, print the lowest hacker_id. The query should print this information for each day of the contest, sorted by the date.</p><p><strong>Input Format</strong></p><p>The following <strong>tables</strong> hold contest data:</p><ul><li><strong>Hackers</strong>: The hacker_id is the id of the hacker, and name is the name of the hacker.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/171/0*OKH-LWXy-U548zIx" /></figure><ul><li><strong>Submissions</strong>: The submission_date is the date of the submission, submission_id is the id of the submission, hacker_id is the id of the hacker who made the submission, and score is the score of the submission.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/217/0*5b--Qbs0-6bKEEL2" /></figure><p><strong>Sample Input</strong></p><p>For the following sample input, assume that the end date of the contest was March 06, 2016.</p><p>Hackers Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/186/0*gP8s3AZ7sKhQVCdd" /></figure><p>Submissions Table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/0*UruUK0hc3lUsvGRs" /></figure><p><strong>Sample Output</strong></p><p>2016–03–01 4 20703 Angela</p><p>2016–03–02 2 79722 Michael</p><p>2016–03–03 2 20703 Angela</p><p>2016–03–04 2 20703 Angela</p><p>2016–03–05 1 36396 Frank</p><p>2016–03–06 1 20703 Angela</p><p><strong>Explanation</strong></p><p>On March 01, 2016 hackers 20703, 36396, 53473 and 79722 made submissions. There are 4 unique hackers who made at least one submission each day. As each hacker made one submission, is considered to be the hacker who made maximum number of submissions on this day. The name of the hacker is Angela.</p><p>On March 02, 2016 hackers 15758,20703 and 79722 made submissions. Now 20703 and 79722 were the only ones to submit every day, so there are 2 unique hackers who made at least one submission each day. 79722 made 2 submissions, and name of the hacker is Michael.</p><p>On March 03, 2016 hackers 20703, 36396 and 79722 made submissions. Now 20703 and 79722 were the only ones, so there are 2 unique hackers who made at least one submission each day. As each hacker made one submission so 20703 is considered to be the hacker who made maximum number of submissions on this day. The name of the hacker is Angela.</p><p>On March 04, 2016 hackers 20703,44065,53473 and 79722 made submissions. Now 20703 and 79722 only submitted each day, so there are 2 unique hackers who made at least one submission each day. As each hacker made one submission so 20703 is considered to be the hacker who made maximum number of submissions on this day. The name of the hacker is Angela.</p><p>On March 05, 2016 hackers 20703, 36396, 38289 and 62529 made submissions. Now 20703 only submitted each day, so there is only 1 unique hacker who made at least one submission each day. 36396 made 2 submissions and name of the hacker is Frank.</p><p>On March 06, 2016 only 20703 made submission, so there is only 1 unique hacker who made at least one submission each day. 20703 made 1 submission and name of the hacker is Angela.</p><p><strong>SOLUTION </strong>:</p><p>Output Goals :</p><ol><li>Submission date</li><li>Total No.of Unique hackers who made submission every day</li><li>Hacker ID and Name of hacker who made maximum no.of submissions</li></ol><p>Conditions for 3 :</p><ol><li>max submissions</li><li>Lowest hacker ID</li></ol><h4>Solution (MS SQL Server) :</h4><pre>WITH cte AS (<br> SELECT <br> submission_date,<br> hacker_id,<br> COUNT(*) AS no_of_Submissions,<br> DENSE_RANK() OVER (ORDER BY submission_date) AS Day_Number<br> FROM Submissions<br> GROUP BY submission_date, hacker_id<br>),<br>cte2 AS (<br> SELECT <br> submission_date,<br> hacker_id,<br> no_of_Submissions,<br> Day_Number,<br> COUNT(*) OVER (PARTITION BY hacker_id ORDER BY submission_date) AS till_date_Submisssion,<br> CASE <br> WHEN Day_Number = COUNT(*) OVER (PARTITION BY hacker_id ORDER BY submission_date) THEN 1 <br> ELSE 0 <br> END AS Unique_flag<br> FROM cte<br>),<br>cte3 AS (<br> SELECT <br> submission_date,<br> hacker_id,<br> no_of_Submissions,<br> Day_Number,<br> Unique_flag,<br> SUM(Unique_flag) OVER (PARTITION BY submission_date) AS unique_count,<br> ROW_NUMBER() OVER (PARTITION BY submission_date ORDER BY no_of_Submissions DESC, hacker_id) AS rn<br> FROM cte2<br>)<br>SELECT <br> cte3.submission_date,<br> cte3.unique_count,<br> cte3.hacker_id,<br> h.name<br>FROM cte3<br>JOIN Hackers AS h ON cte3.hacker_id = h.hacker_id<br>WHERE cte3.rn = 1<br>ORDER BY cte3.submission_date, cte3.hacker_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*sxEeof-DsBj3WXBWswJjuA.png" /><figcaption>Testing Intermediate Outputs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*A6FVsgkKNmdV2THileK7-A.png" /><figcaption>Final Output</figcaption></figure><p>Happy Coding.!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7720336303b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hackerrank Pattern Questions — SQL]]></title>
            <link>https://medium.com/@Shivagni/hackerrank-pattern-questions-sql-f986e66879fe?source=rss-2ba86f16aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/f986e66879fe</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[hackerrank-solutions-sql]]></category>
            <dc:creator><![CDATA[Shivagni Singh Rajput]]></dc:creator>
            <pubDate>Thu, 23 Jan 2025 14:53:07 GMT</pubDate>
            <atom:updated>2025-01-23T14:53:07.017Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hackerrank Pattern Questions — SQL</h3><h3>Problem:</h3><p>P(R) represents a pattern drawn by Julia in R rows. The following pattern represents P(5):</p><pre>* <br>* * <br>* * * <br>* * * * <br>* * * * *</pre><p>Write a query to print the pattern P(20).</p><h4>Solution :</h4><pre>DELIMITER $$<br><br>CREATE PROCEDURE stars(r INT) -- procedure stars() with r as an int<br>BEGIN<br>    DECLARE star INT DEFAULT 1; -- declare star as a variable<br>    WHILE star &lt;= r DO -- loop as long as star is &lt;= r<br>        SELECT REPEAT(&#39;* &#39;, star); -- print out * star number of times<br>        SET star = star + 1; -- increment +1 for each counted row        <br>    END WHILE;<br>END $$<br>    <br>CALL stars(20); -- call procedure with the value 20</pre><ol><li>You’ll need to use two sets of variables (one input for the rows and another to count all of the rows), in my answer I used <em>“r int” </em>and “<em>star int”</em>.</li><li><em>Make sure that your logic is </em>“star &lt;= r” as you want WHILE loop to only last as long as the value of r (which is your procedure input).</li></ol><h4>Output:</h4><pre>*<br>* *<br>* * *<br>* * * *<br>* * * * *<br>* * * * * *<br>* * * * * * *<br>* * * * * * * *<br>* * * * * * * * *<br>* * * * * * * * * *<br>* * * * * * * * * * *<br>* * * * * * * * * * * *<br>* * * * * * * * * * * * *<br>* * * * * * * * * * * * * *<br>* * * * * * * * * * * * * * *<br>* * * * * * * * * * * * * * * *<br>* * * * * * * * * * * * * * * * *<br>* * * * * * * * * * * * * * * * * *<br>* * * * * * * * * * * * * * * * * * *<br>* * * * * * * * * * * * * * * * * * * *</pre><p>Happy coding!</p><p>Having any questions about the topic? Share them in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f986e66879fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[While radicalization is the primary problem, lone-wolf terror attacks across globe points to…]]></title>
            <link>https://medium.com/@Shivagni/while-radicalization-is-the-primary-problem-lone-wolf-terror-attacks-across-globe-points-to-889cd4ed36c0?source=rss-2ba86f16aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/889cd4ed36c0</guid>
            <category><![CDATA[terrorism]]></category>
            <category><![CDATA[international]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[lone-wolf]]></category>
            <dc:creator><![CDATA[Shivagni Singh Rajput]]></dc:creator>
            <pubDate>Sat, 27 Jun 2020 13:48:46 GMT</pubDate>
            <atom:updated>2020-06-29T11:02:23.640Z</atom:updated>
            <content:encoded><![CDATA[<h3>While radicalization is the primary problem, lone-wolf terror attacks across globe points to security, intelligence and systemic failures.</h3><p>Lone-wolf attack is the one in which — extremist individuals translate their beliefs into violent actions that are hard to prevent and detect. Lone-wolf attacks are a severe threat and systematic strategy is the need of the hour as far as security is concerned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*GlwmWkt71B5KMZOO9Wsxaw.jpeg" /><figcaption>Image ©2014 The Augusta Chronicle by Rick McKee.</figcaption></figure><p><strong>What is Lone-wolf terror attack?</strong></p><p>Lone-wolf attack is planned and committed by an individual. A lone-wolf does not avail any outside command and material assistance from any group. Hence, it becomes difficult to track and identify such activities before they actually happen.</p><p>Such attacks across the globe point towards security, intelligence and systematic failures :</p><ol><li>In the contemporary era, many countries have faced such attacks like : UK has come across the three major incidents.</li><li>It is increasing in the North America as analysed by the International Institute for Counter-Terrorism.</li><li>Defence Minister of India while addressing the National Security Guard said that such attacks are a major challenge for India.</li></ol><p>Here is the list of some of the <strong>Main Causes</strong> of such attacks:</p><ol><li><em>Radicalization : </em>It is the process by which an individual adopts drastic political, social or religious ideals (they’re completely brainwashed, which makes it difficult for them to differentiate between good or bad). It is the primary problem which leads to other problems like Lone-wolf attack. Leaders of terrorist groups first try to lure the youngsters in order to make them part of their group. Ajmal Kasab, a terrorist of 2008 Mumbai terror attack, gave a statement that he believes he would get heaven after that attack. This shows how youth is radicalized.</li><li><em>Failure of intelligence system</em><strong> : </strong>The Central intelligence bureau is many a times ill prepared to combat the aggressive operations like : terror attack 26/11, Pulwama attack etc.<br>- Lack of cyber security infrastructure in the country is also an another reason. Also, Terror organisations approach personalized chat-rooms with VPN servers, hence difficult to trace their location.</li><li><em>Detection issues : </em>The terrorist organization like Al-Qaeda and ISIS are now spread across the world. In lone wolf attacks there’s no proper co-ordination &amp; communication, and that makes attack by a single person difficult to detect in the huge population.</li><li><em>Lack of employment and education</em> opportunities, leads to frustrated lifestyle and increases individualism.</li></ol><blockquote>According to Global Terrorism Index 2019, India is at Rank 7 with 748 terrorist attacks and 350 deaths from terrorism in 2018. India didn’t face any big lone-wolf attack but as the lone-wolf attacks are increasing day by day, proper strategy is the need of the hour.</blockquote><p><strong>Suggestions on how India can prepare itself to avoid such attacks</strong>:</p><ol><li>India need to strengthen the capabilities of its intelligence agencies like Research and Analysis Wing ( RAW), Intelligence Bureau ( IB ) etc.</li><li>India also needs to build critical infrastructure to overcome the cyber attacks by the lone wolf. Need to focus on potential terror groups through monitoring and infiltration of social media sites that are the principal source of radical propaganda, using Big Data Analytics.</li><li>Training should be provided to the police personnel to make them more efficient. Also, specialized police teams can be trained &amp; deployed in every state to act as first responder.</li><li>Education and employment should be increased in order to tackle radicalization among youth. One basic need for this would be to provide good internet speed in all regions especially in Jammu &amp; Kashmir.</li><li>State agencies need to work with civil society groups for better framework. There is a need to develop a framework that not only deals with deradicalization but also rehabilitates the misguided youth of the nation.</li><li>Community leaders should work towards deradicalization programmes and make people aware about how to be alert and identify suspicious people with mock drills to help them to stay away from such ideology.</li><li>Lack of co-ordination w.r.t. information sharing is seen between various intelligence agencies at both intra- and inter-governmental levels, which is one of the main reasons for many governments not able to detect lone-wolf attacks, for example information with KGB will never be shared with CIA. This issue needs to be addressed for better security of all.</li></ol><blockquote>Lone-wolf attacks are emerging as a severe threat for every country be it developed or developing. It is required to work at both national and international levels. UNSC can play a key role in this (Prosecution of groups banned by the UNSC should be completed).Thus, India and the world should effectively deal with this challenges as<br>“Great anger and violence is threat to the humanity and mankind”.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=889cd4ed36c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why the U.S. should not give up efforts to bring the Korean talks back on track]]></title>
            <link>https://medium.com/@Shivagni/why-the-u-s-should-not-give-up-efforts-to-bring-the-korean-talks-back-on-track-1855048dd125?source=rss-2ba86f16aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/1855048dd125</guid>
            <category><![CDATA[north-korea]]></category>
            <category><![CDATA[south-korea]]></category>
            <category><![CDATA[international-relations]]></category>
            <category><![CDATA[news]]></category>
            <category><![CDATA[liaison-office]]></category>
            <dc:creator><![CDATA[Shivagni Singh Rajput]]></dc:creator>
            <pubDate>Sat, 20 Jun 2020 13:31:32 GMT</pubDate>
            <atom:updated>2020-06-20T16:20:39.818Z</atom:updated>
            <content:encoded><![CDATA[<p>Korean Peninsula that has been divided into two sovereign states : North Korea (supported by China) and South Korea (supported by U.S.), is the region that faces many uncertainties and challenges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*EjC-pv0InxblqLEQzdQJPw.jpeg" /><figcaption><strong>The joint liaison office in Kaesong Industrial Complex is seen in this undated file photo taken in 2018 and released on Jun 16, 2020. (Yonhap via REUTERS)</strong></figcaption></figure><p>Keeping in mind the past relations that both these counties share, neither of them have officials /embassy in each other’s states. Kaesong Industrial Complex (KIC) was developed by South Korea in North Korea , near Military Demarcation Line, in December 2004. The purpose of KIC was to develop an industrial park where South Korean companies could manufacture their products using North Korean Labor. Later, it was also used as a mediation centre to hold the talks between the two countries, using hotlines.</p><p>But, On June 16, 2020, <strong>North Korea</strong> destroyed the building via <strong>explosion</strong>, amidst heightened tensions between the countries.</p><p>Reasons behind the uncertainties and rising tensions:<br>1. <strong>Sanctions on North Korea</strong> : North Korea has been hit hard by the sanctions from US because of its frequent nuclear tests and development of nuclear weapons.<br>2. <strong>US and South Korea relations : </strong>North Korea feels frustrated at South Korea’s inability to revive inter-Korean economic projects under the pressure of US. US’s interference in South Korea is somewhere unacceptable to Pyongyang.<br>3. <strong>Anti- North Korea propaganda balloons : </strong>Pyongyang objected to activists and defectors in South Korea sending leaflets balloons across the country into North Korea. South’s refusal to crack down on them led to the cut of communication with Seoul.<br>4. <strong>Demolition of Joint liaison office : </strong>The recent demolition of this communication office between both the countries has led to more aggression in the region.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/323/1*Dcg143P_yLS-A1u-k7qYqA.jpeg" /></figure><p>Even though at present, Mr. Trump is grappling with many problems at home — from the Coronavirus outbreak and a sagging economy, to anti-racism protests. Still, the <strong>US needs to revive the talks with North Korea because</strong>:<br>1. The challenges and uncertainties are increasing as mentioned above.<br>2. The U.S. has good relations with South Korea and could initiate talks on behalf of it, since Pyongyang has already cut off all the communication channels with Seoul.<br>Moreover, it has severed hotlines, and is planning to deploy troops along the border. This will lead to more animosity as both the countries are still technically at war.</p><p><strong>Way forward :</strong><br>✔️US should not give up the efforts to bring the Korean talks back on track.<br>✔️It should again revive the denuclearization talks by simultaneously focusing on removing sanctions too.<br>✔️Also, US should have bilateral talks with both the countries as there is still some ray of hope.<br>Thus, the Korean Peninsula needs to restore the peace and bring back the normalcy and US still has opportunity to revive the talks again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1855048dd125" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[India must adopt value-based positions at the UNSC and be the voice of the weaker sections.]]></title>
            <link>https://medium.com/@Shivagni/india-must-adopt-value-based-positions-at-the-unsc-and-be-the-voice-of-the-weaker-sections-5b6519c69d1d?source=rss-2ba86f16aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b6519c69d1d</guid>
            <category><![CDATA[india]]></category>
            <category><![CDATA[international-relations]]></category>
            <category><![CDATA[news]]></category>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[opinion]]></category>
            <dc:creator><![CDATA[Shivagni Singh Rajput]]></dc:creator>
            <pubDate>Sat, 20 Jun 2020 07:45:17 GMT</pubDate>
            <atom:updated>2020-06-20T08:14:32.300Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="India in UNSC :Quest for permanent foothold" src="https://cdn-images-1.medium.com/max/700/1*pCoZNVhu6D0izaW3xz5RuA.gif" /><figcaption>The UNSC is composed of 15 members: five permanent members — China, France, Russian Federation, the United States, and the United Kingdom — and 10 non-permanent members who are elected by the General Assembly.</figcaption></figure><p>India’s recent election to the United Nations Security Council (UNSC) for the 8th term as a non-permanent member for 2 years (i.e.2021 &amp; 2022) starting January 2021 is a significant victory. Now, India must adopt value based positions at the UNSC because:</p><ol><li>India has received a good support from 184 countries out of 193 . This shows that globally, many countries support and trust India.</li><li>This is a good opportunity for India to highlight its agendas of Multilateralism, Comprehensive convention on International terrorism, Reforms policy regarding expansion and veto power etc.</li></ol><p>Barring two regions (North America &amp; Europe), other regions are either underrepresented (like Asia), or not represented at all (like South America, Africa, Australia, and the small island developing states). Weaker Nations lack opportunity to raise their issues in UNSC (e.g., hunger and poverty issues of Uganda, Health issues of Myanmar etc.). India is the undisputed leader of the 3rd World countries, as reflected by its leadership role in NAM &amp; G-77 grouping. Therefore, India’s inclusion in UNSC will strengthen India’s stature as a ‘moralistic force’ for the developing states &amp; help in making UNSC more democratic.</p><p><strong>Way forward </strong>: India must focus on its NORMS policy (New Orientation for a Reformed Multilateral System). It must focus on its leadership role to bring reforms regarding the veto powers and expansion of the membership in UNSC for larger representation. It must put forward the realities of 21st century among the members. It must try to be the voice of weaker nations by raising their issues at the global level. Thus, It is a good opportunity for India to maintain value based positions and play a leadership role for weaker nations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b6519c69d1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>