<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4252381169939701010</id><updated>2026-10-18T08:10:11.997+05:30</updated><category term="Coding"/><category term="cpp"/><category term="codechef"/><category term="ourshopkeeper"/><category term="codeforce"/><category term="Java"/><category term="express"/><category term="snackdown"/><category term="mongoose"/><category term="Adsense"/><category term="Google Adsense"/><category term="mongodb"/><title type='text'>Software Development </title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>144</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-6898577464836535547</id><published>2023-03-05T20:43:00.003+05:30</published><updated>2023-03-05T20:43:36.976+05:30</updated><title type='text'>Save Flowers</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;&amp;nbsp;Save Flowers&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLJSiNbz4VewjrSrVwCom3q5juuL27tv1eYiGYQROYHoar4kCAixRYfcU_1oz61SFPeByH9K4mP6MHD_LPHg0umiXDL6xyaF-Aic0GdeJ_CtOg7INHJ8GM199zXY-ZDx2sABl_vqm1j1ssTKWF0el7HnjcppsEJa-cUoU-nKFL4dJQRw__Aa76zQ/s1063/blg2.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;664&quot; data-original-width=&quot;1063&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLJSiNbz4VewjrSrVwCom3q5juuL27tv1eYiGYQROYHoar4kCAixRYfcU_1oz61SFPeByH9K4mP6MHD_LPHg0umiXDL6xyaF-Aic0GdeJ_CtOg7INHJ8GM199zXY-ZDx2sABl_vqm1j1ssTKWF0el7HnjcppsEJa-cUoU-nKFL4dJQRw__Aa76zQ/w640-h400/blg2.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;// { Driver Code Starts&lt;/div&gt;&lt;div&gt;#include&amp;lt;bits/stdc++.h&amp;gt;&lt;/div&gt;&lt;div&gt;using namespace std;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Array&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;public:&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; template &amp;lt;class T&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; static void input(vector&amp;lt;T&amp;gt; &amp;amp;A,int n)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; n; i++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scanf(&quot;%d &quot;,&amp;amp;A[i]);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; template &amp;lt;class T&amp;gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; static void print(vector&amp;lt;T&amp;gt; &amp;amp;A)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; A.size(); i++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout &amp;lt;&amp;lt; A[i] &amp;lt;&amp;lt; &quot; &quot;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout &amp;lt;&amp;lt; endl;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;// } Driver Code Ends&lt;/div&gt;&lt;div&gt;class Solution {&lt;/div&gt;&lt;div&gt;&amp;nbsp; public:&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; int saveFlowers(int n, vector&amp;lt;int&amp;gt; &amp;amp;arr, string s) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp;vector&amp;lt;int&amp;gt; v(n+1, 0);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; int count =0;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; for(int i=n-1; i&amp;gt;=0; i--){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(s[i]==&#39;1&#39;){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; count =i;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;int curr_sum =0, flag =1, ans =0, last_element=1000;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=count; i&amp;gt;=0; i--){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(s[i]==&#39;1&#39;){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; last_element = min(arr[i], last_element);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; curr_sum = curr_sum + arr[i];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; flag =0;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(!flag&amp;nbsp; &amp;amp;&amp;amp; last_element &amp;lt; arr[i]){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;curr_sum = curr_sum + arr[i] - last_element;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;flag = 1;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; last_element =1000;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ans = max(curr_sum, ans);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return ans;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;// { Driver Code Starts.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int main(){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; int t;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; scanf(&quot;%d &quot;,&amp;amp;t);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; while(t--){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int n;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; scanf(&quot;%d&quot;,&amp;amp;n);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; vector&amp;lt;int&amp;gt; arr(n);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Array::input(arr,n);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string s;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; getline(cin,s);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Solution obj;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int res = obj.saveFlowers(n, arr, s);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;res&amp;lt;&amp;lt;endl;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&amp;nbsp; // } Driver Code Ends&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/6898577464836535547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2023/03/save-flowers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/6898577464836535547'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/6898577464836535547'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2023/03/save-flowers.html' title='Save Flowers'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLJSiNbz4VewjrSrVwCom3q5juuL27tv1eYiGYQROYHoar4kCAixRYfcU_1oz61SFPeByH9K4mP6MHD_LPHg0umiXDL6xyaF-Aic0GdeJ_CtOg7INHJ8GM199zXY-ZDx2sABl_vqm1j1ssTKWF0el7HnjcppsEJa-cUoU-nKFL4dJQRw__Aa76zQ/s72-w640-h400-c/blg2.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-5914017567705623963</id><published>2023-03-05T20:41:00.001+05:30</published><updated>2023-03-05T20:43:42.858+05:30</updated><title type='text'>Nice Array</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Nice Array&lt;/h1&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn2Dy9AN8yD_F89PBg8oCxWyT4c_tPWfogv3mk7iUxuZUXxbg-_INBV-nFzebp1MIbPBzXNQwALKNuzg351oG4Sj3EOgEZulh929eF9glQKg3Og1DAkf7kyistVbg52bPUzxNKTVuZEheIm4brSRQWFf2tDFXoi_n3fQFvURKLt91BzIHxvfyrRw/s1088/blg.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;411&quot; data-original-width=&quot;1088&quot; height=&quot;242&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn2Dy9AN8yD_F89PBg8oCxWyT4c_tPWfogv3mk7iUxuZUXxbg-_INBV-nFzebp1MIbPBzXNQwALKNuzg351oG4Sj3EOgEZulh929eF9glQKg3Og1DAkf7kyistVbg52bPUzxNKTVuZEheIm4brSRQWFf2tDFXoi_n3fQFvURKLt91BzIHxvfyrRw/w640-h242/blg.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Solution:&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;class Solution {&lt;/p&gt;&lt;p&gt;&amp;nbsp; public:&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; int niceSubarray(int n, vector&amp;lt;int&amp;gt; &amp;amp;arr) {&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; //&amp;nbsp; &amp;nbsp;kadane algorithm&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; // sort(arr.begin(), arr.end());&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; int len=0, mx=0, j=1, count =0;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for(int i=0; i&amp;lt;n; i++) {&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(arr[i]==i+1){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;count++;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if(count == n) return n;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for(int i=0; i&amp;lt;=n; i++){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(arr[i]==j){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;j++;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;len++;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}else {&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mx = max(len, mx);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;j=1;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;len =0;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return mx;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/5914017567705623963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2023/03/nice-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5914017567705623963'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5914017567705623963'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2023/03/nice-array.html' title='Nice Array'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhn2Dy9AN8yD_F89PBg8oCxWyT4c_tPWfogv3mk7iUxuZUXxbg-_INBV-nFzebp1MIbPBzXNQwALKNuzg351oG4Sj3EOgEZulh929eF9glQKg3Og1DAkf7kyistVbg52bPUzxNKTVuZEheIm4brSRQWFf2tDFXoi_n3fQFvURKLt91BzIHxvfyrRw/s72-w640-h242-c/blg.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-3529985367556882976</id><published>2023-01-20T23:23:00.001+05:30</published><updated>2023-01-20T23:23:12.318+05:30</updated><title type='text'>Maximum Weight Node</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Maximum Weight Node&lt;/h1&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyRBtqG7ABxbgfgpzO5FtQcmhSFuUsC4bjWUxAqZUSNBzto_SkwRpnQYWF70n46z1BnbzESn3pJv3LwB3tCLW-gZsp3zRf9H7-sreWMLSWL_iBixDgGyqScMCVDfZhTYcWmZJskX2EK-haucdRh59wu3PGom0NPrMQo4BKCbwRSBaKlzNGu3qU0w/s668/Screenshot_20211004-125827_Chrome.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;409&quot; data-original-width=&quot;668&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyRBtqG7ABxbgfgpzO5FtQcmhSFuUsC4bjWUxAqZUSNBzto_SkwRpnQYWF70n46z1BnbzESn3pJv3LwB3tCLW-gZsp3zRf9H7-sreWMLSWL_iBixDgGyqScMCVDfZhTYcWmZJskX2EK-haucdRh59wu3PGom0NPrMQo4BKCbwRSBaKlzNGu3qU0w/s320/Screenshot_20211004-125827_Chrome.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;Given a maze with&amp;nbsp;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;N&lt;/span&gt;&amp;nbsp;cells. Each cell may have multiple entry points but not more than one exit (i.e entry/exit points are unidirectional doors like valves).&lt;br style=&quot;box-sizing: inherit; font-size: 17px !important; line-height: 1.7em;&quot; /&gt;You are given an array&amp;nbsp;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Edge[]&lt;/span&gt;&amp;nbsp;of&amp;nbsp;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;N&amp;nbsp;&lt;/span&gt;integers,&amp;nbsp;where&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;&amp;nbsp;Edge[i]&amp;nbsp;&lt;/span&gt;contains the cell index that can be reached from cell&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;&amp;nbsp;i&amp;nbsp;&lt;/span&gt;in one step.&amp;nbsp;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Edge[i]&lt;/span&gt;&amp;nbsp;is&amp;nbsp;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;-1&lt;/span&gt;&amp;nbsp;if the ith cell doesn&#39;t have an exit.&amp;nbsp;&lt;br style=&quot;box-sizing: inherit; font-size: 17px !important; line-height: 1.7em;&quot; /&gt;The task is to find the cell with&amp;nbsp;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;maximum weight&amp;nbsp;&lt;/span&gt;(The weight of a cell is the sum of&amp;nbsp;cell indexes of all cells pointing to that cell). If there are multiple cells with the maximum weight return the cell with&amp;nbsp;highest index.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Note:&amp;nbsp;&lt;/span&gt;The cells are indexed with an integer value from 0 to N-1.&amp;nbsp;If there is no cell pointing to the ith cell then the weight of the i&#39;th cell is zero.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Example 1:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; padding: 10px; white-space: break-spaces; word-spacing: 4px;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Input:&lt;/span&gt;
&lt;/span&gt;N = 4
Edge[] = {2, 0, -1, 2}&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;
&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Output:&lt;/span&gt; &lt;/span&gt;2&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;
&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Explanation&lt;/span&gt;: 
&lt;/span&gt;1 -&amp;gt; 0 -&amp;gt; 2 &amp;lt;- 3
weight of 0th cell = 1
weight of 1st cell = 0 
(because there is no cell pointing to the 1st cell)
weight of 2nd cell = 0+3 = 3
weight of 3rd cell = 0
There is only one cell which has maximum weight
(i.e 2) So, cell 2 is the output.&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Solution:&amp;nbsp;&lt;/p&gt;&lt;p&gt;//{ Driver Code Starts&lt;/p&gt;&lt;p&gt;//Initial Template for C++&lt;/p&gt;&lt;p&gt;#include&amp;lt;bits/stdc++.h&amp;gt;&lt;/p&gt;&lt;p&gt;using namespace std;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;// } Driver Code Ends&lt;/p&gt;&lt;p&gt;//User function Template for C++&lt;/p&gt;&lt;p&gt;class Solution&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;&amp;nbsp; public:&lt;/p&gt;&lt;p&gt;&amp;nbsp; int maxWeightCell(int N, vector&amp;lt;int&amp;gt; Edge)&lt;/p&gt;&lt;p&gt;&amp;nbsp; {&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; vector&amp;lt;int&amp;gt; ind(N+1, 0);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0; i&amp;lt;N; i++){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(Edge[i]!=-1)&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ind[Edge[i]]= ind[Edge[i]]+ i;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; int a = *max_element(ind.begin(), ind.end());&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; int ans =0;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0; i&amp;lt;N; i++){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(a==ind[i]){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ans = i;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return ans;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;};&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;//{ Driver Code Starts.&lt;/p&gt;&lt;p&gt;int main(){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;int tc;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;cin &amp;gt;&amp;gt; tc;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;while(tc--){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; int N;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cin &amp;gt;&amp;gt; N;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; vector&amp;lt;int&amp;gt; Edge(N);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0;i&amp;lt;N;i++){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;Edge[i];&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Solution obj;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; int ans=obj.maxWeightCell(N, Edge);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;ans&amp;lt;&amp;lt;endl;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;}&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;return 0;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;// } Driver Code Ends&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/3529985367556882976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/maximum-weight-node.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/3529985367556882976'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/3529985367556882976'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/maximum-weight-node.html' title='Maximum Weight Node'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyRBtqG7ABxbgfgpzO5FtQcmhSFuUsC4bjWUxAqZUSNBzto_SkwRpnQYWF70n46z1BnbzESn3pJv3LwB3tCLW-gZsp3zRf9H7-sreWMLSWL_iBixDgGyqScMCVDfZhTYcWmZJskX2EK-haucdRh59wu3PGom0NPrMQo4BKCbwRSBaKlzNGu3qU0w/s72-c/Screenshot_20211004-125827_Chrome.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-4267057537062222443</id><published>2023-01-18T21:37:00.002+05:30</published><updated>2023-01-18T21:37:58.879+05:30</updated><title type='text'>Find the first node of loop in linked list</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;h1 style=&quot;background-color: white; box-sizing: inherit; font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em; text-align: left;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0.87); font-family: sofia-pro; font-size: 20px; font-weight: 700;&quot;&gt;Find the first node of loop in linked list&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;&lt;div&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0.87); font-family: sofia-pro; font-size: 20px; font-weight: 700;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0.87); font-family: sofia-pro; font-size: 20px; font-weight: 700;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;Given a singly linked list of&amp;nbsp;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;N&lt;/span&gt;&amp;nbsp;nodes. Find the first node of the loop if the&amp;nbsp;linked list has a loop. If a loop is present return the node data of the&amp;nbsp;first node of the loop else return -1.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Example 1:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: inherit; font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; padding: 10px; white-space: break-spaces; word-spacing: 4px;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Input:&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;https://media.geeksforgeeks.org/wp-content/uploads/20211123204900/lloop-300x105.jpg&quot; style=&quot;border-style: none; box-sizing: inherit; font-size: 17px !important; height: 105px; line-height: 1.7em; max-width: 100%; width: 300px;&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;
&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Output: &lt;/span&gt;3&lt;/span&gt;
&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Explanation:
&lt;/span&gt;We can see that there exists a loop 
in the given linked list and the first
node of the loop is 3.&lt;/span&gt;&lt;/pre&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Solution:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;//{ Driver Code Starts&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;//Initial Template for C++&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;#include &amp;lt;bits/stdc++.h&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;using namespace std;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;struct Node&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; int data;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; Node* next;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; Node(int val)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data = val;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; next = NULL;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;};&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;void loopHere(Node* head, Node* tail, int position)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; if(position==0) return;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; Node* walk = head;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; for(int i=1; i&amp;lt;position; i++)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; walk = walk-&amp;gt;next;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; tail-&amp;gt;next = walk;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;// } Driver Code Ends&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;//User function Template for C++&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;/*struct Node&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; int data;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; struct Node *next;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; Node(int x) {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; data = x;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; next = NULL;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;*/&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;class Solution&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; public:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; int findFirstNode(Node* head)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Node *slow =head;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Node *fast = head;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int flag=0;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int ans=-1;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while(fast &amp;amp;&amp;amp; slow){&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; slow = slow-&amp;gt;next;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fast = fast-&amp;gt;next-&amp;gt;next;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(fast==slow){&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;flag =1;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(flag==0) return -1;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Node *temp = head;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int n=1;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while(n&amp;gt;0){&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(temp==slow){&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; n=0;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return temp-&amp;gt;data;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; slow = slow-&amp;gt;next;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; temp = temp-&amp;gt;next;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ans;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;};&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;//{ Driver Code Starts.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;int main()&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; int t;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;t;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; while(t--)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int n, num;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;n;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Node *head, *tail;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt; num;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; head = tail = new Node(num);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0 ; i&amp;lt;n-1 ; i++)&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt; num;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tail-&amp;gt;next = new Node(num);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tail = tail-&amp;gt;next;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int pos;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt; pos;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; loopHere(head,tail,pos);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Solution ob;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int ans = ob.findFirstNode(head);&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;ans&amp;lt;&amp;lt;&quot;\n&quot;;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;return 0;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;b&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px; line-height: 1.7em;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;b&gt;// } Driver Code Ends&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/4267057537062222443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/find-first-node-of-loop-in-linked-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/4267057537062222443'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/4267057537062222443'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/find-first-node-of-loop-in-linked-list.html' title='Find the first node of loop in linked list'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-307872139307742536</id><published>2023-01-08T18:31:00.004+05:30</published><updated>2023-01-08T18:31:47.993+05:30</updated><title type='text'>Absolute difference divisible by K</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;Absolute difference divisible by K&lt;/h1&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvL-wiBnQC1JB-_EJ6Y1vXO3C8hFx9CDX8W8w5mVT-brHHPCt2tY_douQb4_uEzFIy0qfFOFwpby1Siaj8UONxrMOUxNlJfl7AqSjRbrClUT6AY154Iina1CcW0TybAAze9Ph98UYRtE6GAxSIEcKZ9Y1F-YUaLESxVc5RLRI6g68BHuuxu0SoWg/s669/Screenshot_20211004-125827_Chrome.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;532&quot; data-original-width=&quot;669&quot; height=&quot;254&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvL-wiBnQC1JB-_EJ6Y1vXO3C8hFx9CDX8W8w5mVT-brHHPCt2tY_douQb4_uEzFIy0qfFOFwpby1Siaj8UONxrMOUxNlJfl7AqSjRbrClUT6AY154Iina1CcW0TybAAze9Ph98UYRtE6GAxSIEcKZ9Y1F-YUaLESxVc5RLRI6g68BHuuxu0SoWg/s320/Screenshot_20211004-125827_Chrome.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;Given an array of integers&amp;nbsp;of size&amp;nbsp;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;n&lt;/span&gt;&amp;nbsp;and an integer&amp;nbsp;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;k&lt;/span&gt;, find all the pairs in the array&amp;nbsp;whose absolute difference is divisible by k.&lt;/span&gt;&lt;br style=&quot;box-sizing: inherit; line-height: 1.7em;&quot; /&gt;&lt;br style=&quot;box-sizing: inherit; line-height: 1.7em;&quot; /&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Example 1:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; padding: 10px; white-space: break-spaces; word-spacing: 4px;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Input:
&lt;/span&gt;n = 3
arr[] = {3, 7, 11}
k = 4
&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Output:
&lt;/span&gt;3
&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Explanation:&lt;/span&gt;
(11-3) = 8 is divisible by 4
(11-7) = 4 is divisible by 4
(7-3) = 4 is divisible by 4&lt;/span&gt;
&lt;/pre&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;br style=&quot;box-sizing: inherit; line-height: 1.7em;&quot; /&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Example 2:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; padding: 10px; white-space: break-spaces; word-spacing: 4px;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Input:
&lt;/span&gt;n = 4
arr[] = {1, 2, 3, 4}
k = 2
&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Output :&lt;/span&gt;
2
&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Explanation:&lt;/span&gt;
Valid pairs are (1,3), and (2,4).&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;Solution:&lt;/b&gt;&lt;/h3&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;long long countPairs(int n, int arr[], int k) {&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int a[n];&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map&amp;lt;int, int&amp;gt; m;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0; i&amp;lt;n; i++){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i] = (arr[i]+k)%k;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m[a[i]]++;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; long long int&amp;nbsp; ans =0;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(auto i=m.begin(); i!=m.end(); i++){&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int no = i-&amp;gt;second;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ans = ans + (no*(no-1)/2);&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ans;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; }&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;fhdfn&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/307872139307742536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/absolute-difference-divisible-by-k.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/307872139307742536'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/307872139307742536'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/absolute-difference-divisible-by-k.html' title='Absolute difference divisible by K'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvL-wiBnQC1JB-_EJ6Y1vXO3C8hFx9CDX8W8w5mVT-brHHPCt2tY_douQb4_uEzFIy0qfFOFwpby1Siaj8UONxrMOUxNlJfl7AqSjRbrClUT6AY154Iina1CcW0TybAAze9Ph98UYRtE6GAxSIEcKZ9Y1F-YUaLESxVc5RLRI6g68BHuuxu0SoWg/s72-c/Screenshot_20211004-125827_Chrome.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-7152348798270005587</id><published>2023-01-02T14:23:00.001+05:30</published><updated>2023-01-02T14:23:26.066+05:30</updated><title type='text'>Maximum Value</title><content type='html'>&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span color=&quot;rgba(0, 0, 0, 0.87)&quot; face=&quot;sofia-pro&quot; style=&quot;background-color: white; font-size: 20px; font-weight: 700;&quot;&gt;Maximum Value&lt;/span&gt;&lt;/p&gt;&lt;p&gt;rg&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP0Z9eB1nJnp8jAyAr3xaz4p69Wo7ybYeD3xVEWxgoB-2pU5imRFlrRE3I6_H4cIamEWhI-e8orwTB8lA-6NutkDil--as845Xw7TFIcgv5buPl87fubS1Matpi-SuFpdMI8f-UEkXKIUE-g2MsFT58X9Ml3IOUGf1-aSrn2DfHzCfC8OpjepK4A/s669/Screenshot_20211004-125827_Chrome.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;532&quot; data-original-width=&quot;669&quot; height=&quot;254&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP0Z9eB1nJnp8jAyAr3xaz4p69Wo7ybYeD3xVEWxgoB-2pU5imRFlrRE3I6_H4cIamEWhI-e8orwTB8lA-6NutkDil--as845Xw7TFIcgv5buPl87fubS1Matpi-SuFpdMI8f-UEkXKIUE-g2MsFT58X9Ml3IOUGf1-aSrn2DfHzCfC8OpjepK4A/s320/Screenshot_20211004-125827_Chrome.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;g&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;//{ Driver Code Starts&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;//Initial Template for C++&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;bits/stdc++.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;std&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;/* A binary tree node has data, pointer to left child&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp;and a pointer to right child */&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;struct&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;data&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;struct&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;left&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;struct&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;right&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;//User function Template for C++&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;/* Tree node structure &amp;nbsp;used in the program&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;struct Node&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; int data;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; struct Node* left;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; struct Node* right;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;}; */&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;maximumValue&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;root&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;queue&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt; *&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;q&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (!&lt;span style=&quot;color: #9cdcfe;&quot;&gt;root&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;q&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;root&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (!&lt;span style=&quot;color: #9cdcfe;&quot;&gt;q&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;empty&lt;/span&gt;())&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;size&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;q&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;size&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp; ans.push_back(q.front()-&amp;gt;data);&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;size&lt;/span&gt;--)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt; *&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;q&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;front&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push_back&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;data&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;q&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;pop&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;left&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;q&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;left&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;right&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;q&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;right&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt; = &lt;span style=&quot;color: #dcdcaa;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;max_element&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;begin&lt;/span&gt;(), &lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;end&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push_back&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;//{ Driver Code Starts.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;newNode&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;val&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;* &lt;span style=&quot;color: #9cdcfe;&quot;&gt;temp&lt;/span&gt; = &lt;span style=&quot;color: #c586c0;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;temp&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;data&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;val&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;temp&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;left&lt;/span&gt; = &lt;span style=&quot;color: #569cd6;&quot;&gt;NULL&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;temp&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;right&lt;/span&gt; = &lt;span style=&quot;color: #569cd6;&quot;&gt;NULL&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;temp&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;buildTree&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // Corner Case&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;length&lt;/span&gt;() == &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt; || &lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;]&lt;/span&gt; == &lt;span style=&quot;color: #ce9178;&quot;&gt;&#39;N&#39;&lt;/span&gt;) &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;NULL&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // Creating vector of strings from input&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // string after spliting by space&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;string&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ip&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;istringstream&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;iss&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #4ec9b0;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;iss&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;;) &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ip&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push_back&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;str&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // Create the root of the tree&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;* &lt;span style=&quot;color: #9cdcfe;&quot;&gt;root&lt;/span&gt; = &lt;span style=&quot;color: #dcdcaa;&quot;&gt;newNode&lt;/span&gt;(&lt;span style=&quot;color: #dcdcaa;&quot;&gt;stoi&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;]&lt;/span&gt;));&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // Push the root to the queue&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;queue&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;*&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;queue&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;queue&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;root&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // Starting from the second element&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (!&lt;span style=&quot;color: #9cdcfe;&quot;&gt;queue&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;empty&lt;/span&gt;() &amp;amp;&amp;amp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ip&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;size&lt;/span&gt;()) {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Get and remove the front of the queue&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;* &lt;span style=&quot;color: #9cdcfe;&quot;&gt;currNode&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;queue&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;front&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;queue&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;pop&lt;/span&gt;();&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Get the current node&#39;s value from the string&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;currVal&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;]&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // If the left child is not null&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;currVal&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;N&quot;&lt;/span&gt;) {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Create the left child for the current node&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;currNode&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;left&lt;/span&gt; = &lt;span style=&quot;color: #dcdcaa;&quot;&gt;newNode&lt;/span&gt;(&lt;span style=&quot;color: #dcdcaa;&quot;&gt;stoi&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;currVal&lt;/span&gt;));&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Push it to the queue&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;queue&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;currNode&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;left&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // For the right child&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;gt;= &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ip&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;size&lt;/span&gt;()) &lt;span style=&quot;color: #c586c0;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;currVal&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ip&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;]&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // If the right child is not null&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;currVal&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;N&quot;&lt;/span&gt;) {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Create the right child for the current node&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;currNode&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;right&lt;/span&gt; = &lt;span style=&quot;color: #dcdcaa;&quot;&gt;newNode&lt;/span&gt;(&lt;span style=&quot;color: #dcdcaa;&quot;&gt;stoi&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;currVal&lt;/span&gt;));&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Push it to the queue&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;queue&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;currNode&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;right&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;root&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;/* Function to get Largest value at each level of Binary Tree */&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;maximumValue&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;struct&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;tree&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;scanf&lt;/span&gt;(&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;%d&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;, &amp;amp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;--) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;getline&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Node&lt;/span&gt;* &lt;span style=&quot;color: #9cdcfe;&quot;&gt;root&lt;/span&gt; = &lt;span style=&quot;color: #dcdcaa;&quot;&gt;buildTree&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ob&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;answer&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ob&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;maximumValue&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;root&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;auto&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;:&lt;span style=&quot;color: #9cdcfe;&quot;&gt;answer&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot; &quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;endl&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/7152348798270005587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/maximum-value.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/7152348798270005587'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/7152348798270005587'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/maximum-value.html' title='Maximum Value'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP0Z9eB1nJnp8jAyAr3xaz4p69Wo7ybYeD3xVEWxgoB-2pU5imRFlrRE3I6_H4cIamEWhI-e8orwTB8lA-6NutkDil--as845Xw7TFIcgv5buPl87fubS1Matpi-SuFpdMI8f-UEkXKIUE-g2MsFT58X9Ml3IOUGf1-aSrn2DfHzCfC8OpjepK4A/s72-c/Screenshot_20211004-125827_Chrome.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-4817096551058711900</id><published>2023-01-02T14:05:00.003+05:30</published><updated>2023-01-02T14:21:48.562+05:30</updated><title type='text'>520. Detect Capital</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;520. Detect Capital&lt;/h1&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border: 0px solid; box-sizing: border-box; color: #262626; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 14px; margin: 0px 0px 1rem;&quot;&gt;We define the usage of capitals in a word to be right when one of the following cases holds:&lt;/p&gt;&lt;ul style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border: 0px solid; box-sizing: border-box; color: #262626; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 14px; list-style-image: initial; list-style-position: initial; margin: 0px 1rem 1rem; padding: 0px;&quot;&gt;&lt;li style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid; box-sizing: border-box; margin-bottom: 0.75rem;&quot;&gt;All letters in this word are capitals, like&amp;nbsp;&lt;code style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: rgba(0, 10, 32, 0.03); border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.05); box-sizing: border-box; color: rgba(38, 38, 38, 0.75); font-family: Menlo, sans-serif; font-size: 0.75rem; line-height: 1rem; padding: 0.125rem; white-space: pre-wrap;&quot;&gt;&quot;USA&quot;&lt;/code&gt;.&lt;/li&gt;&lt;li style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid; box-sizing: border-box; margin-bottom: 0.75rem;&quot;&gt;All letters in this word are not capitals, like&amp;nbsp;&lt;code style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: rgba(0, 10, 32, 0.03); border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.05); box-sizing: border-box; color: rgba(38, 38, 38, 0.75); font-family: Menlo, sans-serif; font-size: 0.75rem; line-height: 1rem; padding: 0.125rem; white-space: pre-wrap;&quot;&gt;&quot;leetcode&quot;&lt;/code&gt;.&lt;/li&gt;&lt;li style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid; box-sizing: border-box; margin-bottom: 0.75rem;&quot;&gt;Only the first letter in this word is capital, like&amp;nbsp;&lt;code style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: rgba(0, 10, 32, 0.03); border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.05); box-sizing: border-box; color: rgba(38, 38, 38, 0.75); font-family: Menlo, sans-serif; font-size: 0.75rem; line-height: 1rem; padding: 0.125rem; white-space: pre-wrap;&quot;&gt;&quot;Google&quot;&lt;/code&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border: 0px solid; box-sizing: border-box; color: #262626; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 14px; margin: 0px 0px 1rem;&quot;&gt;Given a string&amp;nbsp;&lt;code style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: rgba(0, 10, 32, 0.03); border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.05); box-sizing: border-box; color: rgba(38, 38, 38, 0.75); font-family: Menlo, sans-serif; font-size: 0.75rem; line-height: 1rem; padding: 0.125rem; white-space: pre-wrap;&quot;&gt;word&lt;/code&gt;, return&amp;nbsp;&lt;code style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: rgba(0, 10, 32, 0.03); border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.05); box-sizing: border-box; color: rgba(38, 38, 38, 0.75); font-family: Menlo, sans-serif; font-size: 0.75rem; line-height: 1rem; padding: 0.125rem; white-space: pre-wrap;&quot;&gt;true&lt;/code&gt;&amp;nbsp;if the usage of capitals in it is right.&lt;/p&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border: 0px solid; box-sizing: border-box; color: #262626; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 14px; margin: 0px 0px 1rem;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYXAUJ3KHQW4DA3CU0Z4nHdqmHWBzZXtU06Lxu2hbN9I4q3oFi20OKYem7tHXY9h1E8XLlkCgSMulCjlFZtFDhODXxasdSiYYg3mFMwApsvlbUhDs0JBqqMrZPwvCv_AcaZd1G-lCDOknd21f2nt8ftEpHBEL1b6cyWtYnH6lvMEluuR0aaAsVjg/s669/Screenshot_20211004-125827_Chrome.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;532&quot; data-original-width=&quot;669&quot; height=&quot;254&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYXAUJ3KHQW4DA3CU0Z4nHdqmHWBzZXtU06Lxu2hbN9I4q3oFi20OKYem7tHXY9h1E8XLlkCgSMulCjlFZtFDhODXxasdSiYYg3mFMwApsvlbUhDs0JBqqMrZPwvCv_AcaZd1G-lCDOknd21f2nt8ftEpHBEL1b6cyWtYnH6lvMEluuR0aaAsVjg/s320/Screenshot_20211004-125827_Chrome.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border: 0px solid; box-sizing: border-box; color: #262626; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 14px; margin: 0px 0px 1rem;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border: 0px solid; box-sizing: border-box; color: #262626; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 14px; margin: 0px 0px 1rem;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border: 0px solid; box-sizing: border-box; color: #262626; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 14px; margin: 0px 0px 1rem;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border: 0px solid; box-sizing: border-box; color: #262626; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 14px; margin: 0px 0px 1rem;&quot;&gt;&lt;span class=&quot;example&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid; box-sizing: border-box; font-weight: bolder;&quot;&gt;Example 1:&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: rgba(0, 10, 32, 0.03); border-radius: 0.5rem; border: 0px solid; box-sizing: border-box; color: rgba(38, 38, 38, 0.75); font-family: Menlo, sans-serif; font-size: 14px; line-height: 1.25rem; margin-bottom: 1rem; margin-top: 1rem; overflow: auto; padding: 1rem; white-space: pre-wrap;&quot;&gt;&lt;span color=&quot;rgb(38 38 38/var(--tw-text-opacity))&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-text-opacity: 1; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid; box-sizing: border-box; font-weight: bolder;&quot;&gt;Input:&lt;/span&gt; word = &quot;USA&quot;
&lt;span color=&quot;rgb(38 38 38/var(--tw-text-opacity))&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-text-opacity: 1; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid; box-sizing: border-box; font-weight: bolder;&quot;&gt;Output:&lt;/span&gt; true
&lt;/pre&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border: 0px solid; box-sizing: border-box; color: #262626; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, &amp;quot;Helvetica Neue&amp;quot;, Arial, &amp;quot;Noto Sans&amp;quot;, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 14px; margin: 0px 0px 1rem;&quot;&gt;&lt;span class=&quot;example&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid; box-sizing: border-box; font-weight: bolder;&quot;&gt;Example 2:&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: rgba(0, 10, 32, 0.03); border-radius: 0.5rem; border: 0px solid; box-sizing: border-box; color: rgba(38, 38, 38, 0.75); font-family: Menlo, sans-serif; font-size: 14px; line-height: 1.25rem; margin-bottom: 1rem; margin-top: 1rem; overflow: auto; padding: 1rem; white-space: pre-wrap;&quot;&gt;&lt;span color=&quot;rgb(38 38 38/var(--tw-text-opacity))&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-text-opacity: 1; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid; box-sizing: border-box; font-weight: bolder;&quot;&gt;Input:&lt;/span&gt; word = &quot;FlaG&quot;
&lt;span color=&quot;rgb(38 38 38/var(--tw-text-opacity))&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgba(59,130,246,0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-text-opacity: 1; --tw-translate-x: 0; --tw-translate-y: 0; border: 0px solid; box-sizing: border-box; font-weight: bolder;&quot;&gt;Output:&lt;/span&gt; false&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Solution:&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;background-color: white; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; line-height: 18px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #267f99;&quot;&gt;Solution&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: blue;&quot;&gt;public:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;bool&lt;/span&gt; &lt;span style=&quot;color: #795e26;&quot;&gt;detectCapitalUse&lt;/span&gt;(&lt;span style=&quot;color: #267f99;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #001080;&quot;&gt;word&lt;/span&gt;) {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; sam=&lt;span style=&quot;color: #098658;&quot;&gt;0&lt;/span&gt;, cap=&lt;span style=&quot;color: #098658;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; n = &lt;span style=&quot;color: #001080;&quot;&gt;word&lt;/span&gt;.&lt;span style=&quot;color: #795e26;&quot;&gt;length&lt;/span&gt;();&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #af00db;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; i=&lt;span style=&quot;color: #098658;&quot;&gt;0&lt;/span&gt;; i&amp;lt;n; i++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #af00db;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #001080;&quot;&gt;word&lt;/span&gt;[i]&amp;gt;= &lt;span style=&quot;color: #a31515;&quot;&gt;&#39;a&#39;&lt;/span&gt; &amp;amp;&amp;amp; &lt;span style=&quot;color: #001080;&quot;&gt;word&lt;/span&gt;[i] &amp;lt;=&lt;span style=&quot;color: #a31515;&quot;&gt;&#39;z&#39;&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sam++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #af00db;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #001080;&quot;&gt;word&lt;/span&gt;[i]&amp;gt;=&lt;span style=&quot;color: #a31515;&quot;&gt;&#39;A&#39;&lt;/span&gt;&amp;amp;&amp;amp; &lt;span style=&quot;color: #001080;&quot;&gt;word&lt;/span&gt;[i]&amp;lt;=&lt;span style=&quot;color: #a31515;&quot;&gt;&#39;Z&#39;&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cap++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #af00db;&quot;&gt;if&lt;/span&gt;(sam ==n|| cap==n) &amp;nbsp;&lt;span style=&quot;color: #af00db;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #af00db;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #001080;&quot;&gt;word&lt;/span&gt;[&lt;span style=&quot;color: #098658;&quot;&gt;0&lt;/span&gt;]&amp;gt;=&lt;span style=&quot;color: #a31515;&quot;&gt;&#39;A&#39;&lt;/span&gt; &amp;amp;&amp;amp; &lt;span style=&quot;color: #001080;&quot;&gt;word&lt;/span&gt;[&lt;span style=&quot;color: #098658;&quot;&gt;0&lt;/span&gt;]&amp;lt;=&lt;span style=&quot;color: #a31515;&quot;&gt;&#39;Z&#39;&lt;/span&gt; &amp;amp;&amp;amp; sam == n-&lt;span style=&quot;color: #098658;&quot;&gt;1&lt;/span&gt;) &lt;span style=&quot;color: #af00db;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #af00db;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/4817096551058711900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/520-detect-capital.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/4817096551058711900'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/4817096551058711900'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2023/01/520-detect-capital.html' title='520. Detect Capital'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYXAUJ3KHQW4DA3CU0Z4nHdqmHWBzZXtU06Lxu2hbN9I4q3oFi20OKYem7tHXY9h1E8XLlkCgSMulCjlFZtFDhODXxasdSiYYg3mFMwApsvlbUhDs0JBqqMrZPwvCv_AcaZd1G-lCDOknd21f2nt8ftEpHBEL1b6cyWtYnH6lvMEluuR0aaAsVjg/s72-c/Screenshot_20211004-125827_Chrome.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-6626470818962344387</id><published>2022-10-31T20:51:00.003+05:30</published><updated>2022-10-31T20:52:04.389+05:30</updated><title type='text'>Find the Town Judge leetcode (997)</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #212121; font-size: 16px; font-weight: 600;&quot;&gt;997&lt;/span&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #212121; font-size: 16px; font-weight: 600;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #212121; font-size: 16px; font-weight: 600;&quot;&gt;Find the Town Judge&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhirxaA0RTnLlKHtkLHj4m67vW91A1aQv_grryyZ-IjrIXSxqF45mUSGVCxkD2egsiGP7119BWh9gfHHXHT-8DVVT4j95sKGb6XgT60US2uSlQqT_8_1m8U5dNBlBzdf1owqaCDylLlkzznEMl3gB16z8mIowf9X95zk_g27dZXtxdaqAGpF2oCFg/s669/Screenshot_20211004-125827_Chrome.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;532&quot; data-original-width=&quot;669&quot; height=&quot;254&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhirxaA0RTnLlKHtkLHj4m67vW91A1aQv_grryyZ-IjrIXSxqF45mUSGVCxkD2egsiGP7119BWh9gfHHXHT-8DVVT4j95sKGb6XgT60US2uSlQqT_8_1m8U5dNBlBzdf1owqaCDylLlkzznEMl3gB16z8mIowf9X95zk_g27dZXtxdaqAGpF2oCFg/s320/Screenshot_20211004-125827_Chrome.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #263238; font-size: 14px;&quot;&gt;In a town, there are&lt;/span&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #263238; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;n&lt;/code&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #263238; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #263238; font-size: 14px;&quot;&gt;people labeled from&lt;/span&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #263238; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;1&lt;/code&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #263238; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #263238; font-size: 14px;&quot;&gt;to&lt;/span&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #263238; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;n&lt;/code&gt;&lt;span face=&quot;-apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;&quot; style=&quot;background-color: white; color: #263238; font-size: 14px;&quot;&gt;. There is a rumor that one of these people is secretly the town judge.&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;If the town judge exists, then:&lt;/p&gt;&lt;ol style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;The town judge trusts nobody.&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Everybody (except for the town judge) trusts the town judge.&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;There is exactly one person that satisfies properties&amp;nbsp;&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;1&lt;/span&gt;&amp;nbsp;and&amp;nbsp;&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;2&lt;/span&gt;.&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;You are given an array&amp;nbsp;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;trust&lt;/code&gt;&amp;nbsp;where&amp;nbsp;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;trust[i] = [a&lt;span style=&quot;bottom: -0.25em; box-sizing: border-box; font-size: 9.75px; line-height: 0; position: relative; vertical-align: baseline;&quot;&gt;i&lt;/span&gt;, b&lt;span style=&quot;bottom: -0.25em; box-sizing: border-box; font-size: 9.75px; line-height: 0; position: relative; vertical-align: baseline;&quot;&gt;i&lt;/span&gt;]&lt;/code&gt;&amp;nbsp;representing that the person labeled&amp;nbsp;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;a&lt;span style=&quot;bottom: -0.25em; box-sizing: border-box; font-size: 9.75px; line-height: 0; position: relative; vertical-align: baseline;&quot;&gt;i&lt;/span&gt;&lt;/code&gt;&amp;nbsp;trusts the person labeled&amp;nbsp;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;b&lt;span style=&quot;bottom: -0.25em; box-sizing: border-box; font-size: 9.75px; line-height: 0; position: relative; vertical-align: baseline;&quot;&gt;i&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;Return&amp;nbsp;&lt;em style=&quot;box-sizing: border-box;&quot;&gt;the label of the town judge if the town judge exists and can be identified, or return&amp;nbsp;&lt;/em&gt;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;-1&lt;/code&gt;&lt;em style=&quot;box-sizing: border-box;&quot;&gt;&amp;nbsp;otherwise&lt;/em&gt;.&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;&lt;span class=&quot;example&quot; style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Example 1:&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(247, 249, 250); border-radius: 3px; box-sizing: border-box; color: #263238; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13px; line-height: 1.6; margin-bottom: 1em; margin-top: 0px; overflow: auto; padding: 10px 15px; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Input:&lt;/span&gt; n = 2, trust = [[1,2]]
&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Output:&lt;/span&gt; 2
&lt;/pre&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;&lt;span class=&quot;example&quot; style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Example 2:&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(247, 249, 250); border-radius: 3px; box-sizing: border-box; color: #263238; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13px; line-height: 1.6; margin-bottom: 1em; margin-top: 0px; overflow: auto; padding: 10px 15px; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Input:&lt;/span&gt; n = 3, trust = [[1,3],[2,3]]
&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Output:&lt;/span&gt; 3
&lt;/pre&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;&lt;span class=&quot;example&quot; style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Example 3:&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background: rgb(247, 249, 250); border-radius: 3px; box-sizing: border-box; color: #263238; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13px; line-height: 1.6; margin-bottom: 1em; margin-top: 0px; overflow: auto; padding: 10px 15px; white-space: pre-wrap;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Input:&lt;/span&gt; n = 3, trust = [[1,3],[2,3],[3,1]]
&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Output:&lt;/span&gt; -1
&lt;/pre&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;p style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;Constraints:&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;background-color: white; box-sizing: border-box; color: #263238; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: 14px; margin-bottom: 1em; margin-top: 0px;&quot;&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;1 &amp;lt;= n &amp;lt;= 1000&lt;/code&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;0 &amp;lt;= trust.length &amp;lt;= 10&lt;span style=&quot;box-sizing: border-box; font-size: 9.75px; line-height: 0; position: relative; top: -0.5em; vertical-align: baseline;&quot;&gt;4&lt;/span&gt;&lt;/code&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;trust[i].length == 2&lt;/code&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;All the pairs of&amp;nbsp;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;trust&lt;/code&gt;&amp;nbsp;are&amp;nbsp;&lt;span style=&quot;box-sizing: border-box; font-weight: bolder;&quot;&gt;unique&lt;/span&gt;.&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;a&lt;span style=&quot;bottom: -0.25em; box-sizing: border-box; font-size: 9.75px; line-height: 0; position: relative; vertical-align: baseline;&quot;&gt;i&lt;/span&gt;&amp;nbsp;!= b&lt;span style=&quot;bottom: -0.25em; box-sizing: border-box; font-size: 9.75px; line-height: 0; position: relative; vertical-align: baseline;&quot;&gt;i&lt;/span&gt;&lt;/code&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;code style=&quot;background-color: #f7f9fa; border-radius: 3px; box-sizing: border-box; color: #546e7a; font-size: 13px; padding: 2px 4px;&quot;&gt;1 &amp;lt;= a&lt;span style=&quot;bottom: -0.25em; box-sizing: border-box; font-size: 9.75px; line-height: 0; position: relative; vertical-align: baseline;&quot;&gt;i&lt;/span&gt;, b&lt;span style=&quot;bottom: -0.25em; box-sizing: border-box; font-size: 9.75px; line-height: 0; position: relative; vertical-align: baseline;&quot;&gt;i&lt;/span&gt;&amp;nbsp;&amp;lt;= n&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span style=&quot;color: #546e7a; font-family: monospace;&quot;&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #546e7a; font-family: monospace;&quot;&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #546e7a; font-family: monospace;&quot;&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;Solution:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #546e7a; font-family: monospace;&quot;&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #546e7a; font-family: monospace;&quot;&gt;&lt;span style=&quot;font-size: 13px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #546e7a; font-family: monospace;&quot;&gt;&lt;div&gt;class Solution {&lt;/div&gt;&lt;div&gt;public:&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; int findJudge(int n, vector&amp;lt;vector&amp;lt;int&amp;gt;&amp;gt;&amp;amp; edges) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int ans =-1;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;vector &amp;lt;int&amp;gt; ind(n+1);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; vector &amp;lt;int&amp;gt; out(n+1);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for(int i=0; i&amp;lt;edges.size(); i++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;out[edges[i][0]]++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ind[edges[i][1]]++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for(int i=0; i&amp;lt;ind.size(); i++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if((ind[i]==n-1)&amp;amp;&amp;amp;(out[i]==0)){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ans =&amp;nbsp; i;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //&amp;nbsp; break;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return ans;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Happy Coding ;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/6626470818962344387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/10/find-town-judge-leetcode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/6626470818962344387'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/6626470818962344387'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/10/find-town-judge-leetcode.html' title='Find the Town Judge leetcode (997)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhirxaA0RTnLlKHtkLHj4m67vW91A1aQv_grryyZ-IjrIXSxqF45mUSGVCxkD2egsiGP7119BWh9gfHHXHT-8DVVT4j95sKGb6XgT60US2uSlQqT_8_1m8U5dNBlBzdf1owqaCDylLlkzznEMl3gB16z8mIowf9X95zk_g27dZXtxdaqAGpF2oCFg/s72-c/Screenshot_20211004-125827_Chrome.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-1544919117665212979</id><published>2022-10-16T18:56:00.004+05:30</published><updated>2022-10-16T18:56:31.479+05:30</updated><title type='text'>Move Last Element to Front of a Linked List</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;b style=&quot;font-size: xxx-large;&quot;&gt;Move Last Element to Front of a Linked List&lt;/b&gt;&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: xx-large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggc_-a1PU6paCucpitoQ3JG0y62Tz1No46MPOVr6RGlOkpdDHZ72Qqct85nPvk3DqIJcbI9HQQpi7wyULu9egvq0eYA-SH2Dneft3AbigTUPTlLcFdoU_dFbvbKvWH4gUllGDwlz5O1IM1shbq7q8mRSqFS16_qCZ6k27bBCUW_qRcZ5prAkwL9g/s668/Screenshot_20211004-125827_Chrome.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;409&quot; data-original-width=&quot;668&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggc_-a1PU6paCucpitoQ3JG0y62Tz1No46MPOVr6RGlOkpdDHZ72Qqct85nPvk3DqIJcbI9HQQpi7wyULu9egvq0eYA-SH2Dneft3AbigTUPTlLcFdoU_dFbvbKvWH4gUllGDwlz5O1IM1shbq7q8mRSqFS16_qCZ6k27bBCUW_qRcZ5prAkwL9g/s320/Screenshot_20211004-125827_Chrome.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h1&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 style=&quot;background-color: white; box-sizing: inherit; line-height: 1.7em; margin: 0px 0px 1em; text-align: left;&quot;&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0.870588235294118); font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;You are given the head of a Linked List. You have to move the last element to the front of the Linked List and return the list.&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0.870588235294118); font-family: urw-din;&quot;&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Example 1:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; padding: 10px; white-space: break-spaces; word-spacing: 4px;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;Input:&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;
&lt;/span&gt;N = 5
List = {2,5,6,2,1}&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;
Output:&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 18px; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;
&lt;/span&gt;{1,2,5,6,2}&lt;span style=&quot;box-sizing: inherit; font-size: 17px !important; font-weight: bolder; line-height: 1.7em;&quot;&gt;
Explanation:
&lt;/span&gt;In the given linked list, the last element is 1,
after moving the last element to the front the
linked list will be {1,2,5,6,2}.&lt;/span&gt;&lt;/pre&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din !important; font-size: 17px !important; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;//{ Driver Code Starts&lt;/div&gt;&lt;div&gt;//Initial Template for C++&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &amp;lt;bits/stdc++.h&amp;gt;&lt;/div&gt;&lt;div&gt;using namespace std;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class ListNode{&lt;/div&gt;&lt;div&gt;public:&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; int val;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; ListNode *next;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; ListNode(int x){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; val=x;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; next=NULL;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;// } Driver Code Ends&lt;/div&gt;&lt;div&gt;//User function Template for C++&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Solution{&lt;/div&gt;&lt;div&gt;public:&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; ListNode *moveToFront(ListNode *head){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(head==NULL) return NULL;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if(head-&amp;gt;next ==NULL) return head;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if(head-&amp;gt;next-&amp;gt;next ==NULL){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ListNode *temp =head, *t=head;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; head = head -&amp;gt;next;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t-&amp;gt;next= NULL;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; head-&amp;gt;next= temp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ListNode *temp = head, *t =head-&amp;gt;next, *t1=head;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while(temp-&amp;gt;next!=NULL){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; temp = temp-&amp;gt;next;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while(t-&amp;gt;next-&amp;gt;next!=NULL){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t = t-&amp;gt;next;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t-&amp;gt;next =NULL;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; head = temp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; head-&amp;gt;next = t1;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return head;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//{ Driver Code Starts.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int main(){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; int t;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;t;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; while(t--){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int n;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;n;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; vector&amp;lt;ListNode*&amp;gt; a(n);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(int i=0;i&amp;lt;n;i++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int x;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;x;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i]=new ListNode(x);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(i!=0){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a[i-1]-&amp;gt;next=a[i];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ListNode *head=a[0];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Solution ob;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; head=ob.moveToFront(head);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while(head!=NULL){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;head-&amp;gt;val;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(head-&amp;gt;next!=NULL){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&quot; &quot;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; head=head-&amp;gt;next;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;endl;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; return 0;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;// } Driver Code Ends&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Happy Coding 😊.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/1544919117665212979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/10/move-last-element-to-front-of-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/1544919117665212979'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/1544919117665212979'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/10/move-last-element-to-front-of-list.html' title='Move Last Element to Front of a Linked List'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggc_-a1PU6paCucpitoQ3JG0y62Tz1No46MPOVr6RGlOkpdDHZ72Qqct85nPvk3DqIJcbI9HQQpi7wyULu9egvq0eYA-SH2Dneft3AbigTUPTlLcFdoU_dFbvbKvWH4gUllGDwlz5O1IM1shbq7q8mRSqFS16_qCZ6k27bBCUW_qRcZ5prAkwL9g/s72-c/Screenshot_20211004-125827_Chrome.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-8330629878304166996</id><published>2022-09-28T01:47:00.002+05:30</published><updated>2022-09-28T01:47:37.161+05:30</updated><title type='text'>Heap sort </title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: xx-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: xx-large;&quot;&gt;Heap Sort C++ Code :&amp;nbsp;&lt;/span&gt;&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggc_-a1PU6paCucpitoQ3JG0y62Tz1No46MPOVr6RGlOkpdDHZ72Qqct85nPvk3DqIJcbI9HQQpi7wyULu9egvq0eYA-SH2Dneft3AbigTUPTlLcFdoU_dFbvbKvWH4gUllGDwlz5O1IM1shbq7q8mRSqFS16_qCZ6k27bBCUW_qRcZ5prAkwL9g/s668/Screenshot_20211004-125827_Chrome.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;409&quot; data-original-width=&quot;668&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggc_-a1PU6paCucpitoQ3JG0y62Tz1No46MPOVr6RGlOkpdDHZ72Qqct85nPvk3DqIJcbI9HQQpi7wyULu9egvq0eYA-SH2Dneft3AbigTUPTlLcFdoU_dFbvbKvWH4gUllGDwlz5O1IM1shbq7q8mRSqFS16_qCZ6k27bBCUW_qRcZ5prAkwL9g/s320/Screenshot_20211004-125827_Chrome.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h1&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;std&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;heapify&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;, &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;largest&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;l&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt; * &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; + &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;r&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt; * &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; + &lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;l&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt; &amp;amp;&amp;amp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;l&lt;/span&gt;] &amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;largest&lt;/span&gt;])&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;largest&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;l&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;r&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt; &amp;amp;&amp;amp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;r&lt;/span&gt;] &amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;largest&lt;/span&gt;])&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;largest&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;r&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;largest&lt;/span&gt; != &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;swap&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;], &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;largest&lt;/span&gt;]);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;heapify&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;largest&lt;/span&gt;);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;heapSort&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt; / &lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt; - &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;gt;= &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;--)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;heapify&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt; - &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;gt;= &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;--)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;swap&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;], &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;]);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;heapify&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;, &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;void&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;printArray&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;] &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot; &quot;&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;()&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\nCode With Khushpreet&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;endl&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Enter the number of element: &quot;&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;endl&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Enter the element: &quot;&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;endl&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;];&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;heapSort&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Sorted array is &lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;printArray&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;);&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Time Complexity&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; line-height: 19px; white-space: pre;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Worst Case Time Complexity is: &lt;span style=&quot;color: #dcdcaa;&quot;&gt;O&lt;/span&gt;(NlogN)&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Average Case Time Complexity is: &lt;span style=&quot;color: #dcdcaa;&quot;&gt;O&lt;/span&gt;(NLogN)&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Best Case Time Complexity is: &lt;span style=&quot;color: #dcdcaa;&quot;&gt;O&lt;/span&gt;(NLogN)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Happy Coding 😊.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/8330629878304166996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/09/heap-sort.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/8330629878304166996'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/8330629878304166996'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/09/heap-sort.html' title='Heap sort '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggc_-a1PU6paCucpitoQ3JG0y62Tz1No46MPOVr6RGlOkpdDHZ72Qqct85nPvk3DqIJcbI9HQQpi7wyULu9egvq0eYA-SH2Dneft3AbigTUPTlLcFdoU_dFbvbKvWH4gUllGDwlz5O1IM1shbq7q8mRSqFS16_qCZ6k27bBCUW_qRcZ5prAkwL9g/s72-c/Screenshot_20211004-125827_Chrome.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-5479144503104920045</id><published>2022-08-04T18:39:00.006+05:30</published><updated>2022-09-29T15:26:33.099+05:30</updated><title type='text'>adjacency list of a bidirectional graph</title><content type='html'>&lt;h1&gt;Given the adjacency list&amp;nbsp;of a bidirectional graph. Your task is to copy/clone the adjacency list for each vertex and return a new list.&lt;/h1&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7o1w-oZ-prlOxaZIyURw9WRiSKCNVMnTacjwdt7bmOjBtoStX4PWJEm2z-0kMQ_Ms9Zw4rbqBZpWC-5jbzJFU6fKXOM9mSIOujbVtnMGuMOinyQPbdpNaSbyhoMZqyqDP3lTR7DQyPb5kkNlMEaUmYdvrxyNj6E772PyM3ujdLUMX7EvqNCXS_w/s668/Screenshot_20211004-125827_Chrome.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;409&quot; data-original-width=&quot;668&quot; height=&quot;196&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7o1w-oZ-prlOxaZIyURw9WRiSKCNVMnTacjwdt7bmOjBtoStX4PWJEm2z-0kMQ_Ms9Zw4rbqBZpWC-5jbzJFU6fKXOM9mSIOujbVtnMGuMOinyQPbdpNaSbyhoMZqyqDP3lTR7DQyPb5kkNlMEaUmYdvrxyNj6E772PyM3ujdLUMX7EvqNCXS_w/s320/Screenshot_20211004-125827_Chrome.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br style=&quot;box-sizing: inherit; line-height: 1.7em;&quot; /&gt;&lt;span style=&quot;box-sizing: inherit; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Example 1:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din; line-height: 1.7em; padding: 10px; white-space: break-spaces; word-spacing: 4px;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Input:&lt;/span&gt;
&lt;img alt=&quot;&quot; src=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPMAAACiCAYAAACUJPttAAAgAElEQVR4Ae1dB3gUVdfmsSE+KliwIXawN34bFgQLNUJAUnY32fSEJJRUElJIDJBCCSn0TmhGIwFB1FD0wy6gYkMUC4j46aegKIr1/M97deK47GZ3Z+7s3rs7d599dnbKLe8578yde885tx2ZyUTARCAgEGgXEK0wG2EiYCJAJplNJTARCBAETDIHiCDNZpgImGQ2dcBEIEAQMMkcIII0m2EiYJKZgw78+OOPtG/fPnrrrbdo06ZNtHbtWnrppZfogw8+oK+++op+++03DqWYWQABYAlMgS0wBtbAHNhDBpBFsCaTzBok//nnn9Ojjz5KmUWZFJMaQxaLhX0jYyJpaNZQGlw8mMJSw1r3W2wWSh6TTONLx9OGDRvo8OHDGkoNzkuAFTArLS2l9DHpZLVZW3G1ploprDiMIrIiyBLzlwwgC8gkryiPyQiyCpZkktkLSe/cuZOKZxWTxWqhAWUD6Jq119AlL1xCnXd1plO+PYXaOXxOOHoCddzXkbrs6ELdWrrRLYtuocjkSKZsS1cspc8++8yL0oPrVGCzcMVCikuNI2uylfou6sswBJbAFNg64g0ZQBaQCWQTXhZOVquVqmZVEWQX6MkkswcSfu6552jkxJEUER9Bt82/jc5757xjFMlRsVz9P/nQyXTl01dS/5L+7AkzpX4KvfHGGx7UIjhOARZ19XUMm0ElgxhWwMwVnu72Q1aQmTXeSuMmjiPIMlCTSeY2JHv06FEaXzeehucNp6vWX0WnfHPs09edMrV1/Py3zqc759zJFLepqamNmgTHIWCAbvKgOYMI2LSFnbfHILsb199I9jw7VdZVEmQbaMkkswuJvvfeexQzJobumH0Hnfy99ieDJ0p30asXsad+SXWJi9oE/u7K6kqyxFsIWHiCmdZzIMs+s/tQ3Jg4gowDKZlkdiLNNevWsCcEusNalcbb6/C+16eiDyVkJATViCxGn9My0iikIsTpuIO3OHp6PmSLXsC6deucaICcu0wyO8itqqaKCRkDKZ4qBs/zrmu6jpW/e/duh5oF3l+0EYRCm3li6GlekDHKr6mpCQhwTTKrxDh3yVwm3BN+Pnak1FMF4XHe+TvPZ/X44YcfVLULrE20DURCW3lgpjUPyBr1WLJkifQAm2T+W4Tbtm1jQj1799l+VS5FKW9ovIESMhOkVzBXDUDb0Ealvf78hcxBaOiAzMkkMxHt2bOHCfPGVTcKoVyKYveu6E2VSypl1i+ndS9dUkpom9JOEX4hexAauiBrCnoyHzx4kOIz4+muuruEUi5FwYflDguoQZoV61ZQaG6okFhDBxIzEwk6IWMKejKXTSmjfiX9hFQuEBqDNLZ4G7NDllHB1HWGLTXa4q/BReUG2dbvkJIhVDGlQl1tabaDmsyvvPIK61qd+fGZwpIZigdT0LyyPGmUylVF88vy6YYWMd6TXREauoDuNnRDthTUZIaRRq8pvYQmMpSu/eH2BKeCd999Vzb9aq0v6m5LtbG2uCKSKPt71/emsuqy1rrLshG0ZP7666/ZHRhG+aIoUVv16LG0B1XPr5ZFr46pZ8X8Crpl6S1SYK1MDUJHZEpBS+ZVTasoJCuEjvv9OL4K1q4dtXP8cigB0yd43zxy5IhM+sXqijpHxUeRYdN+arw5YI2bar+KfvR40+NSYR20ZE4Yk0DXP3Y9J9H//UxVK5XjNoeSQipDqKWlRSoFQ2VR5+GVwzkg4KLvosaaUykXv3Qx80GXCeygJDMM7DHI0fHzjpxE7+RprFYwZVtnaZc9fxnlT8iXSb9YXcdPGE+ouwsq6tuvYKv86svtX1fHFMZI5YwRlGTeunUrhWZznutUlAm/6o+r/epzPNzutK8TxY2Kk47MCaMSCHX/Fy56/6lxVW/rzVd1/aAZgwi6IksKSjI3NDdQr6kcR7HdKZO74yoFakvhTzxyIutRfP/997LoF6Gu6AWh7m21zatjajwdt/mVQrAKa2qWx888KMlctqCMblp5Ez+xqxXKWa7ujju7xsW+8NRwksmjinlGpVpctMYrCv+ThyOejv//OVPXVreN3ah6gTwzCEFJ5tFVo+my5zi+w7lTJnfHvVC5kKIQev7556V5MqOuw4s4D34BT/WHI77qfC944wLKr5JnjCIoyZwwNoE67+bor+xOmdwdVyumm+1e03vRqlWrpCEz6tp/en83rVJTSMM2R3zVpeM9P2VsijRYByWZoxKi+FoiuVMmd8e9UPUeDT0oNTWVpkyZIsUXdb294XYvWqimk4fbHPFVl4j3fOiKLMkkMw81c6dM7o57UQeQOSc3h5qbm6X45ubm0h0Nd3jRQjWdPNzmiK+6RJPMEtzGEvMS+XruuFMmd8e9UPV7qu+hxsZGCVD+q4qo64DqAV60UE0nD7c54qsusdPeTpSSZ3azhVa2zCmZdMXmK/gpmDtlcnfci5qEFIRINfeJedqwgjAvWqimk4fbHPFVl9hlexcaN2Wc0LqsrlxQdrMrFlcQuqtqwenadqdM7o57UZPw5HCpomGwKC7JnKemHPHiiK9aD7o/051qFssT7C8oydy4rpF/2BpXCuVqv6NCevC//fftmQGGTM4WqCuMRlB3NVG4bnPEWF2vm5ffTM3rmtUPP6G3g5LMcDx/eNTDfJVLrVCutnWWCMf5+Ox4oRXKWeVGZI8gQwNAqPHWibGazKHTQ6UKUhCUZP7iiy/Y0+Lc987lKHo3zhYcSrr6yaupfHa5M74IvW/GnBl07ZPXckBATTXVtgFkbv9De4pJjyHoiiwpKMkM4YwqHkW3LriVv4KpFUvZ5lTKkIIhtGPHDll0q7WeWAwuoiCCEwoqEis5Kjjjl9PnqqeuorHFY1vbIMNG0JIZC3SHJYZRh4MdOImflxo5z+fCbRdSXIF8HlMKCRIKEghtcN468faG5YexRdyV+svwG7Rk/vXXX8mWaKMrn/LdelJ6VPbO+jtpyRp5V12YtWYW3V1/txRkvnTrpRSdGE3QEZlS0JIZQqpfUE/9isUNs6uQ//T9p5PFZpHq/c2RBAcOHGBtQFuUdon6O2TiEFqwYIFjE4T/H9RkViKOdH2tq9AKdn3T9VReK9/Al6P2V9VW0d1NYj+doQuYSpNxudegJjOUbdmyZRSWEkZnfiJm7OzLt1xOUUlR9MknnzhyQ7r/aEN0UjShTSI+laED4SnhTCekA5eIgp7MEFpBXQH1H2ewm54G9YVtsCXKQtu3b5dRt5zWGW1Bm9A20QgNHcipy3Fabxl2mmQmYuFr8fTjGkqIg6qGjgmlVRvl8V32VOGbNzbTsDHDOCDE73YA2duT7FKGMlZwN8n8NxKff/45e1e6coMYo9t9yvtQ0YwiRU4B91sxo4LQRn501J4TZI73ZOiAzMkks0p6a9asYUL193zozctuppikGFXNAm8To9u2aBuhrdppqP9KvL+DyBs3bpQeZJPMKhGWlJTQI488woR77WoDzQ9dqC9MCPuO70tJGUmqWgXe5rPPPktRUVE0Y8YMShudRiHjQwht109N73KAjEHk+Ph4gpWa7Mkk898SXL58OY0dO5Z+//13+uyzzyg6LZrurLuTb3ihNtQVweOgWEXVgdu1/u9//0tTp06lxMRE+s9//tPKnerqatZ2YOAdHbWdjYX47qm7h+xpdiZrhGB6/HG5lqJpBU+1YZKZiF577TWmTLt27VJBQ5QzLYeG5A6h894+z1Alu6HxBlb+iqYV/yo/kP6gG2u326murs7pYuZNTU0Mg9sabzMUa8gyPDecCqYVtML7xBNPUGVlZet/WTeCnswHDx6klJQUWrdunVMZPr7mcaZkd9XeRV1f52dcctqB0+i61dfR0NyhlJiRSK+//rrT8mXfiZUU8eRFV/a5555rsznAIC0jjWy5NoYNMNL27D32KshuUO0gJkuMjajTW2+9RcnJyepdUm4HPZnR7YOytZX27t1L9SvryZpupQH5A+iatdfQqV+dqknRuuzoQj1n9qTIqEhKKkiip556ir777ru2ipf22ObNmyk2NpZqamrom2++8agdwAKYjCoYxeajgRUwO5ae7vdARpDVkPwhZE+3U8PKBoIsHdMPP/zASC6Tu6NjG/A/qMm8du1aFrb20KFDzrA5Zh+E3vxMM6UUp5AlxkL3Tb6PuVFe23wtYZ1nLFna4VAHOv7X46nj/o6Ed8Duz3Znq2fAUWJw4WCmNHlT8qRyej8GCDc7QFwQOC4ujkBorQlBJEqnlDLMHi58mIAhViIBpsAWGANrYA7sIQPIAq6t/Sb3I2uMlUYXj6ZnnnmGILu2UnZ2Nr3wwgttnSL8saAl8/vvv8+URGv3FtfBFLS0tpRSi1MpOjWa5YdBLOVrjbJSXEYcZU7MpKmzptKjjz5KH3zwgfBKoaeC6EqjS43eDq/FyoEZsKueVU0ZEzMoPiOegK2Cs/JrT7UzWRTWFjLZeCPbWbNm0ZIl8nqlQWZBSebffvuNcnJyaMUKvgNOP//8M/Ns+vDDD50O8ughiejXYuwBg1sxMTE+m7NdtGgRZWVlMcyBvZ6Ep3dxcbGeLPx+bVCSee7cuWw+2e/oB0gFMM2E6SaMP2D6yRcJMw94Ir/zzjtcivvoo4/IZrPRH3/8wSU/f2QSdGTesmULM1jYt2+fP/AOqDIxWFVfX0/R0dEEQxBfJjxFGxoauBUJEoPMILWsKajIDNtbKJ6eQRlZBc273hgswnTO5MmTCaaZvkyrV6+mzMxMZuDDs9zx48ezwTKeefoyr6AiM0w158yZ40t8A66sw4cP08yZM9lT7Omnn/Z5+z799FPWvd62bRv3sjEAhrbJmoKGzCtXriRMP8gW10kkxXrppZdoxIgRzFpq//79fqnapEmTaN68eYaUjd4GdETWFBRkxl0cgyUyhoIRQbF+/PFHmj17NsMQBh3+Shs2bGB2AaiPEYnFKbNYCL0PGVPAkxmDNGlpaeRowiejsPxRZxhuAL/y8nLy56Dhl19+yQYujTbswDgAzDtlTAFP5unTp7NFyWUUjj/r/NNPPxGm8NCjcWW37sv6TZs2jc1jG11mVVUVwfFCxhTQZF6/fj0bcfXULlhGARpR51dffZVGjhxJEydOdGrLbESZbeUJqzLYePtCjnCFxAi9jClgyQwTQDxVoJhm8gyBo0eP0vz58xlusFsXIeE1CQYpvooEgiAFGOSTMQUkmWEAkJeXJ23IVH8oEuyYR48eTWVlZYTpH1ESbKbR9fVV+v7779nNzFeWbDzbFZBkxmoEMAAwk3sEMFW3cOFCpsDNzWKtRYzBN/SufB1oDwYpmIaTLQUcmWEnDAUQ6ekiqlIghnVGRgaVlpbSxx9/LFQ10eUfNWoUPfnkkz6vF2KT8TQV9VUDAorMmCeE105LS4uv8JOyHMQ5W7x4MbvpwTRSxASPKFjs+SNhPhs3ONlSQJEZo694xzKTawQwwAO3QbyGiOpU8Oabb7Ibjb/qt3v3bmbD7xpFMY8EDJkbGxuZ8b1ev1YxxaS/Vn/++SctXbqUkQTB80ROubm59Nhjj/mtivB3x6uaaK8e7gAJCDLjaQPw3377bXftDcrjsGhCMAa4DeKpI3KCDf24ceP8XsWioiLpXtekJzNiO2GgRFarHaO1FqGNcKPz55PO0zbyDjjgabnOzsM7O+zRZUrSk7m2tjYgYh7zVhr0UhDUv7CwkBzjgfMui1d+vAMO6KkXZkXQ3ZcpSU1mjDomJCRwCxwnk+Daqitim+FpjCB4siSMqmOaDCPtIiS4eALDI0eOiFAdj+ogLZkx0gmwZZzc90gyGk569913meUb3jllcvfEckCQpREBBzTA2HoJzEhlGoeRlswFBQXSh0Zt1RoOG6tWrWKEwACSbAnulfDQEi1VVFSQaFZxbWEkJZlh8IB3QTMRIf43nsSwRecVqdKXuCL0EBwbjAo4oKctmO6E66UsSToywzkdXTLZ5gCNUAgoG7DACpYyJjgzIMDi1q1bhaw+zF0RmEGWJBWZIXysloCA5cGc4N6JnglGW3fu3CktFFj1ArMRoiYE9sfNktfKHEa3Uyoy4x0GcZqDOcF5HgoGRwBYdcmalIAD//vf/4RuwpgxY6RZF0waMsMEEf62Ir5b+UIbseQN5mERPRK2yzInBBxISkqSwsIKPQdZXmOkIDO6kngaya7EWgmoLESOuM6izMNqbQuu83XAAT11RegpBGyQIQlPZkzao6uD7mWwpT179lBJSQlzINmxY0dANN9fAQe0ggfrObjVypCEJzMcxTEPGWwJFlHojcBGGF48gZB++eUXvwUc0Iof6gw5yBDsQmgyYzEyLNiNmMnBkj755BPmlI/eiGgWUXplgBuTjE7/MFDatGmT3uYbfr2wZIZS444o6hykEZJBoH60GTHM8EQIpAQ3TLTNXwEH9GAJeRi1JI6eejleKyyZ4U+KQHPBkGCbPGHCBNYFRZTMQEyYE4eRi4wJ02iwsBM9CUPmb7/9ljnOw3ECgz7p6emEoAN79+4N6OkoBKzDEwt3/kCNkgK78fz8fNG54LJ+0EHISHT5+I3MzF90Qi7Fjokli81C4WnhFFIcQvfW3ks3r7qZ7q2+l/pW9aVhucPIEmchW5yNRuSMoNr6Wmn8c11qBxG7SWFFQ9y0AjlQv7IYgUzeR87kBstDeKWJnHxKZrjllc8vJ2u8lfpV9qPLnr+MOu3tRCf+dCK1c/M55ZtTqPMHnanH8h4UOTKSUnJTCCsSfvXVVyLj67RumLvEnR5rRcvkL+u0MW52InAgYo/JnhAs0h9hf73BzSdkfvHFFymrLIsiUyOpx9IedPbus91Qt21qg/yXb76cBk4ayEhRV1cnfGwrCAXB3GGSmpqaSi+//LI3cpLyXLgPIuBAIEyt4VUBixCKnAwn84onVrAncbeWbtT+cHtdJHZG8XPeP4cG1A+g6Lhon61HpEWgiIpitVpZXCnELQv0pAQcCJQBPbQDi+mJnAwjMwYL8mryaEjuEDrz4zO5k9iR2DetuIk9pUUbAf/iiy/YWkkpKSmEHkqwJFEDDmjFHytQ4tXIFytRaq2jIWRW7sq9K3p79D7sSEyt/7s/050BnlcixjQCXDVtNhvNnDmTsCBZsCQl4ECg9UAQBfa1114TVozcyaw4Bdw27zbDn8bOSH/al6dRWFIY2ePsfgMdFmtTpkxhnkHBZPQCwEUPOKBHKfDOjHdnURNXMivLilzXdJ1fiKwm94CSAZQ3wfdPaKxzhegZ8Ls+dOiQqHI3rF6iBxzQ03CMZmNUW9TEjcyHDx9mXdy+RX39TmSF1OHx4bS6xTcLo2GKDPGiEPr3+eefF1XehtYL7YaHkegBB7SCgHlmzDeLmriReVTRKApNCxWGyCD06V+czm4wRhsswAgfSgxHdliyBWPCmAACDsA5JlATBnUxCAaLMBETFzLPXzyfNfLcd88Viswg9MUvX0zRKdHsXY63APAEwnsU7tZbtmzhnb1U+WEpl8rKSqnqrKWysNGGrbaISTeZMcCDuxXmkZXurWi/N628iYqqirjiD/LCPRNkDtRupaeAwRwVOrBv3z5PL5H2PNjQw4tKxKSbzGPLxpK/Rq69uWlE5kZyCcyGbnRNTQ3FxsZK4eNqtNLBVROx2dauXWt0UULkv3nzZiFWqXQGhi4yI+g67sidd3UW9qmsEP661ddRUbW+pzMGeDDAhYEuGW3CnSmA3n1YkEDGgANa242II9B5Ef3NdZG5en413TPtHuGJDEKfduA0skRZCAYt3iZMMcH+2263SxFR0tv2aT1fCTiAyKHBlNArw0oioiXNZIZZmy3eRhduu9A4MrdrR+2UL4dSes7sSYtWLfJKBhgTwCgtjEBkDF8EJwc4eODLO7InloyVNeCAV0qgOhkYYgEChN8VzYFEM5nhxjfkkSEcKKZ0hB1+FRIrvxxK6rKjC8WPifeoi4SpFgQTjIqKkmYFDbz2YJqsdkUtZU/LpviseNYlRLdQ+SblJlFhbSEtalzE5sO1LvMje8ABFT9dbgIb+N2vbFxJk2onUXpueiuOCp6pWalUNrWMGlY0MOz9ud6XZjKPKx1Hl2+5nAPFHEis5KiQWPlV9uv8jSyMZBFMXEqQiDlEwDGiqqqK4CghckJvYWnzUorLjKPwonDqVdeLMHqP2YUL3rjgL3/xIyfSSUdOojM+O4Mu3H4hXfn0ldRjWQ8aUD2AbKNtlF2VzabWPF1gIFACDjiTKzDYtGUT5VTlUPToaHqo+iGGFTADdsAQWJ7040l0xqdnUNfXutJV669irr2h1aEUMyqGMgoy2ICgr3tymsmcMCaBOu7rqJNaHhIZhOb06VPfx+UoNBwDEKAdropwWRQ5weC/uK6YjQPg9QG9Di0YnfDzCXTZc5dR/4r+FJ0WTbOXzHb7PhgoAQfU8sU7cM2SGrKl2ahfRT+GCbDxFlMFz5DyELJGWWlq3VSfOWdoIjPeFRDq58Sf3UcI8RaM1ndk5Yms/HoNq/OS8dSa0zhHLUe2jdhjCBqA4AH79+8/5rgoO1C3wvJCwlQbRugxsOe8pd7vRSSXW5fcSlEpUS6DKSLgAMIAi/a+qEc+s+bPYoZFdy25i0Wz8R4551cAz/sW30f2FDtNKp9kuF5pIjOmZSLSI7gp0b+gUMjr+MuptO7PdqfCWf+s7YywPQjfg3cgjAOInPA0to+ws270vzDjhI2S56lfnUoDpg+g0SWj/+UsogS2E9kN0Bv5IZzziPwRNHD6QEKblfbz/kXeA+sHUuyIWEOf0prIjHemwSWD+TdeTWDk7vifQ4l4j0ydkMpkjqVSEFAPgfVEt156fPVfqz/CPJW3srnK79rma1kgRSWQHXotuPEFQtq4cSO7gaONrtrPe7/ib4/VSoxImsiMLul99ffxBcEZcZ3t01lqx/0dKWZMDAtti6ex6EHaIPSq+iqKiI9gjiO8Fcxdfhe8eQFTeli9YVAQ3nGyJ6Unhra5az/v44i6A70zYmliTWSG6d7/rfo/vkA4I66zfTpLPf7X49n7PoLOazEg8bUiV82oMqYX5AWOHQ51YAooqk2yNzLBdCPIhDbxJqo3+Q0fP5xNfXpTd3fnaiIzHPB7LuzJDwxXpHW1X0fJEGJUcpQ7XIQ43vJiC0XGROporTfq1fa5nfZ1YiSA8YmsCTHYQGS0pe3W+uaoNcbKNS6cJjJjpYn+Vf35ANIWYds6prF0hPmNLxTXwVwhijKXixFR36iW+1JuXHUj2ZJsUsb6VvBEG9y31DdnQLa4uaBuPJImMmNUc3jucD6gqAnrybbOUi954RIaXT2aB3aG5YHZApAG02i+USvPS+ld2ZvG1o01rO1GZAw87Ul2Qt09b6lvzoSMUTcejjuayAwrGSwZw6W5nhBYfY7OUjF6OWHpBCN0hkuemL/NKc+hu6vv1tlSLtI5pg4nHjmRhmYOpcXLFnNpr9GZAM+S8hIKzQwl1N0YVPTlen/1/VRcXqx77l4TmSEArP2EJWP0NcNh+klNWlfbOku8dcGttHL9SqN1SHP+WNb14byH6ZRvOWCrEytXsj3/rfNZ99CfdsieAqwszIc6u2qPv/dD1tF50brtHDSTOS0njau1jFNA1YTmJIoBkwdwCVLgqTJ5c96ff/5JcISAra9TPATae1ftXVQ1u8qb5vnl3NyCXHqg9gGBkHMuWcg8ozhDF0aayYx5sjuW3GEsSJzJDEscS4xFWOcJuFtiPplLj8dYyVDX17syu3CRTV8Vf2vU1TmFxNkLmVviLaQn+KRmMu/atYsVbqQZHG8LsGvWXkMji8VdLyi7Iptum++fxQO0qPXA/IG0vHG5rqeJkRfjgTMk30A3Xc63CMi+cr72oIiayQwhYFlVEQLee6qID+U/5NJjykil8iRvmEximuK8d87jqyLq3o2yzakE3BzjR8fTTz/95EkTfXrOr7/+SlablVBHT/XD4/MUHNW/HEqB7KOToum7777ThJUuMmN95GFjhvl0PSmPAXcAF10tW6KNIGQR09y5c6l/Gae5e7RdrWjOth3w0YKr8toCO2fREoI0wCiDe8/RGZbqfTpxDS8L1xyaSheZMTeGpwkMyLUogy+vuaf2HqpfUC+azrXWZ1TeKL5PEbWCudrmILX7J99PixZ5F4qptdEGbqBOD059kEMLVVrqCkf1fp0l3rj2RuY3oAUaXWRGgQh0NzRvqNBTKQjOj5vOe++9pwUjn1wTnRhNF7/EySNKrVzYVn/Ux9T7NW7fsugWKp5S7BOMvCkkb3IecbX2UuPWFqaOx7zEFTqQ9UiWN01tPVc3mXfv3s0WOhfVyOH4X46n0PGhtGzZstZGi7aBeGO42Zz94dleiv5fNP3nWrXi/bP3r622jjme68H/q9ddTSn5KaJBSil5KXTp1ks9aIELDB2vdIebu+OO+bn4Dx2A37OWpJvMKFTxDRXR/PDmZTdTUZ2+eNlagPXmGiUWc4eDBnvyqBUO2xw+F71ykZCOK1GJUXTWnrM4tPBvlNTYOcvV3XFn1zjZBx3AjV3LIBgXMkNxFy5cyCohkmPARa9exEYHEU1E5LR9+3aKjDXQO0qtaMq2E0XSQu6zPjqLyV2kEW1lgTctMby0YMCuUXDFr86PNdZKmPr1NnEjMwrOK8mjiBiDwgl5CdDpB/5aARIB2hGoD0716M7ijnfw4EG2WiNif2OdKAzkYZFwRFNENE4YQsDVD9FH4POMJydCzOzZs4c++ugjQp54vQDgCASHd3GYNmLCf+fOnQRjBXiW7dixg0DUbdu2sXAxWJMJ0U0Q3AHueC+88ALBUGTmzJk0LGOYly30QmXUisZB2dQln/zdyYzMiJ6BBdVE+KIukakG3hwdJaXG1/GYhv+ROZGaFiLkSmYQ2h5np0ElgzQ0Qa0i+rYV31t0V3h8bTYbi5+NRdSxqgVWNMCicVj9EcvVIEh+cnIyi8SBoHRayPoAAAdYSURBVIBpaWksHNHIkSPZOkwIgJeRkUFZWVmUnZ1NOTk5lJubS1hRMD8/n50fmm/gcrhqZVNvc5ASC/ZgsbB2FRQUkAhfYByeHc6hdR7ooRpPbHP4hI0P0xQBhzuZQej8CfmEhc6xPjKPxnmTB0YwQeCmpib2xMWTF09gLPiGZWbwZMYTGk9qeH+hC44u4tGjR1lwfMxDw9Pmjz/+INhK+yLhKR2WFuYbrDgrn9IDEmldavS8uHn1tSUVzlgqem5Ns7Ienbe6ZwiZUYnVLasZqXwVgA7ubfBXjYqLIiUAnbdg+Ot8ZhprsdAJR72P06wogFe/aiVsS1k9OHb+zvPJarf6CzqX5SJmNXeDETUeagyxzekDHcDDSMviC4aRGSjjHRIxmI0e5YZ728OZD1NmSea/QsO6lLRgB77++msmQAQb5KIUakVzlqO7486ucbHv8s2XU2ymtqkUI8UQnxFPhgXsU+PHkciQ/en7TydbrE0TNIaSGTXCwFJBVQFF5EZwD9oOE81etb0YETCaLmtClx5PN24+t2plc0ZCd8edXeNi3w2NN1DGJH2ue0bILWNihjGupGrsOBMZZIYOpI1L0wSJ4WRWaoVR3PzqfN3LqaDrBON5OE0gMN/8ZfO5xVBS6uqP3+TMZLpi4xUuKOPl87othWvrmIbSe87oSdPmTPMHZG2WWTOnhm6bx9kDjTN2zqR6xaYrqLJem+eUz8isII8u5cKmhRQ7JpbCC8Pp3vp7WTccK00gQD26mhghxZQH5jBhlAArI5gNDpw8kBnPZ07MpJdffll3mBWlTiL8Tpo8ibXRmYA17XNUPGf/NZDXsS6DCwezwUYRMFTXAQOgYYWcBxWdYehsnw5c+y7qqxlPn5NZDTjmZzHPOm/1PCqaV0Rp5WkUmxXLupzRKdGUWJhIGdUZVL60nBrXN7I52gMHDqizCJhtzD1HJEfQyYdO1qEKDlRzpmjKPg6lYLE6eCb5erVDT4SujENoXVDPAUn3XmgKrvjV+IHsrclWzaur+JXMngglmM5JyE9gy61qVQan16mVTNnWqGyO+WP1ydJ5pcKKqGhSEaGOjvXW9F/BzpNfjSVi2dic6Tma8TTJrBk6/hc+tu4x6lvSV6MqaFJRzWVh9cnIqEihPdGwULolysJ1pUwjUYaxFRY+0JpMMmtFzoDrYNRiS7bxG9XWTFX3KovlZNMr0w1AgW+WCSMT2CyK+xb59wyMYsdmxOoKnmGSma/u6M5tZsNM6jmHU9fQQDIPzR3KdWkV3cC5yGD58uVsWtS/VHVf+qA5g2jFyhUuWuHZbpPMnuHks7OwWog93U7dWroZSEX3ytXWGbcuvJUyqzJ9homegoBnQnoCoc5ttcmfxyDruPQ4Ql31JJPMetAz6Fp4WcGkDxFS/KlkzsrGiiDWFCszBjKo+dyzVfD05VrMzrBztk+JgoM66k0mmfUiaND1C9YvoKFpQ4Ui8zm7zmE3mR1v7zCo1cZl+8T6J1jd0QZnpPLXvoi0CGpe38yl4SaZucBoTCboyvYtEmd0OzwmnBa1iBe8z1P0S6tKCW3wF3Edy+1X1I8mVPFb98wks6ea4Ifz4IKJ7rYIsclxU8mcIMd7sitRKXiKcIOETCFbnm62JpldSV6Q/YhuAqHfXeOfVSE7fNuBdfft8XZBENFXDQXP0LRQQtscn5ZG/z/u9+Ood0VvJlPUhWcyycwTTYPyQvCEpKwkCskOYbbrRiuckn+XN7owpcuvyDeoZf7JFl5q2fnZrG1oo9Jeo3877+rMgnaMzBppyCogJpn9o0+aSp04ayJTwEtevMRwBYRRCHoEDU0Nmuoqw0ULGhawNqKtRhP56ievZmVNnzXdMGhMMhsGrTEZI6xxVFIU3T7ndu6WYvBWQ6zpByY/QEmFSSw4oTGtECdXTAkl5SfR4MmDWduBAS9iK3gib3uSnYWkNrLlJpmNRNegvBExtLahlnnYPFjyIHPO0ONt1WlvJ0KQgcEZg8mea6dH1zxqSDfQIDh0Z4s4cFjkPjE3kYZnDGdYABOtpFbwRF72ZDs1NDSwKK+6K+omA5PMbgAS+TBsuZetW0Zx+XEUnhzO/KFhTXTh9gvpjM/OoJOOnHSMQrY/3J7O/PhM6vpqV7ryqSvZwBq606kVqdSytYXr6KrI2DmrG0aW4ZKbVZHFusQP1DzAMAJWwAzYORLcEc++NX3Zten56bRu3TqfhrEyyexMqhLugz90yeQSSsxOJARRB0HxHZ40nAblD2LfsMSw1v22BBtbwmX63OnSBUD0hXgQFBIrc6bnpROwUvAMTwxvxRPbyn5gnpadRpMnT2Zx0X1RR8cyTDI7IhIg/xFuFlMfr7/+Om3YsIF98X6IYP5alj4JEFg0NwOYATtgqOAJbIExsBYhmWQWQQpmHUwEOCBgkpkDiGYWJgIiIGCSWQQpmHUwEeCAgElmDiCaWZgIiICASWYRpGDWwUSAAwImmTmAaGZhIiACAiaZRZCCWQcTAQ4I/D9limwJAVLiHgAAAABJRU5ErkJggg==&quot; style=&quot;border-style: none; box-sizing: inherit; line-height: 1.7em; max-width: 100%;&quot; /&gt;
&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Output:&lt;/span&gt; 
0-&amp;gt; 1-&amp;gt; 4 
1-&amp;gt; 0-&amp;gt; 2-&amp;gt; 3-&amp;gt; 4 
2-&amp;gt; 1-&amp;gt; 3 
3-&amp;gt; 1-&amp;gt; 2-&amp;gt; 4 
4-&amp;gt; 0-&amp;gt; 1-&amp;gt; 3
&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Explanation&lt;/span&gt;:
As 0,1 and 3 is connected to 4 so 4th row
of the list containing 4 and its connected
nodes 0,1 and 3 and we have to add those in
sorted order and same for every row.
&lt;/span&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;p style=&quot;background-color: white; box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din; line-height: 1.7em; margin: 0px 0px 1em;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br style=&quot;box-sizing: inherit; line-height: 1.7em;&quot; /&gt;&lt;span style=&quot;box-sizing: inherit; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Example 2:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: inherit; color: rgba(0, 0, 0, 0.87); font-family: urw-din; line-height: 1.7em; padding: 10px; white-space: break-spaces; word-spacing: 4px;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; line-height: 1.7em;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Input:&lt;/span&gt;
&lt;span style=&quot;box-sizing: inherit; line-height: 1.7em;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;data:image/png;base64,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&quot; style=&quot;border-style: none; box-sizing: inherit; line-height: 1.7em; max-width: 100%;&quot; /&gt;&lt;/span&gt;

&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Output:&lt;/span&gt; 
0-&amp;gt; 2-&amp;gt; 3 
1-&amp;gt; 2 
2-&amp;gt; 0-&amp;gt; 1 
3-&amp;gt; 0
&lt;span style=&quot;box-sizing: inherit; font-weight: bolder; line-height: 1.7em;&quot;&gt;Explanation&lt;/span&gt;:
As 2 and 3 is connected to 0 so 0th row
of the list containing 0 and its connected 
nodes 2 and 3 and we have to add those in
sorted order and same for every row. 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Solution:&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/h3&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;//{ Driver
Code Starts&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;#include
&amp;lt;bits/stdc++.h&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;using
namespace std;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;// } Driver
Code Ends&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;class
Solution&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;public:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Function to return the adjacency list
for each vertex.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; vector&amp;lt;vector&amp;lt;int&amp;gt;&amp;gt;
printGraph(int V, vector&amp;lt;int&amp;gt; adj[])&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vector&amp;lt;vector&amp;lt;int&amp;gt;&amp;gt; v;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; V; i++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; i;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int j = 0; j &amp;lt;
adj[i].size(); j++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; &quot;-&amp;gt;
&quot; &amp;lt;&amp;lt; adj[i][j];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; endl;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return v;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;//{ Driver
Code Starts.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;int main()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int tc;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cin &amp;gt;&amp;gt; tc;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (tc--)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int V, E;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cin &amp;gt;&amp;gt; V &amp;gt;&amp;gt; E;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vector&amp;lt;int&amp;gt; adj[V];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; E; i++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int u, v;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cin &amp;gt;&amp;gt; u &amp;gt;&amp;gt; v;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adj[u].push_back(v);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; adj[v].push_back(u);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Solution obj;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vector&amp;lt;vector&amp;lt;int&amp;gt;&amp;gt; ans =
obj.printGraph(V, adj);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; ans.size(); i++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int j = 0; j &amp;lt;
ans[i].size() - 1; j++)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; ans[i][j]
&amp;lt;&amp;lt; &quot;-&amp;gt; &quot;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; ans[i][ans[i].size()
- 1];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; endl;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;// } Driver
Code Ends&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;





















































































































&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size: 16pt; line-height: 107%;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;line-height: 107%;&quot;&gt;Happy Coding&amp;nbsp;&lt;/span&gt;&lt;span face=&quot;Roboto, &amp;quot;helvetica neue&amp;quot;, helvetica, arial, sans-serif&quot; style=&quot;background-color: white; color: #4d5156;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span face=&quot;Roboto, &amp;quot;helvetica neue&amp;quot;, helvetica, arial, sans-serif&quot; style=&quot;background-color: white; color: #4d5156;&quot;&gt;🤭&lt;/span&gt;&lt;span face=&quot;Roboto, &amp;quot;helvetica neue&amp;quot;, helvetica, arial, sans-serif&quot; style=&quot;background-color: white; color: #4d5156;&quot;&gt;&amp;nbsp;.&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/5479144503104920045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/08/adjacency-list-of-bidirectional-graph.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5479144503104920045'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5479144503104920045'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/08/adjacency-list-of-bidirectional-graph.html' title='adjacency list of a bidirectional graph'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7o1w-oZ-prlOxaZIyURw9WRiSKCNVMnTacjwdt7bmOjBtoStX4PWJEm2z-0kMQ_Ms9Zw4rbqBZpWC-5jbzJFU6fKXOM9mSIOujbVtnMGuMOinyQPbdpNaSbyhoMZqyqDP3lTR7DQyPb5kkNlMEaUmYdvrxyNj6E772PyM3ujdLUMX7EvqNCXS_w/s72-c/Screenshot_20211004-125827_Chrome.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-56495143019325755</id><published>2022-07-12T13:44:00.001+05:30</published><updated>2022-07-12T13:47:11.720+05:30</updated><title type='text'>Puri Sharma Pathania book pdf</title><content type='html'>&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Puri Sharma Pathania book pdf Download.&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGvFoY4NbNNugM1-3veUgTYmz-_BvxiaJ9xpN_VJR0iYIcWWaYsKimr6XPJAO6IAxPg_pZcBcw8mUM-hLmy6Kvae8eCM4W0kBova_w58eW8sQVDPysQAiehIGNOxBty5eQM6UID1zGIgJrLuufOOGkgV_YcCyT6ScCuSGgqtZlkhH-OH3kSOH_Qw/s971/Screenshot_20220712-133813_OneDrive.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;971&quot; data-original-width=&quot;707&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGvFoY4NbNNugM1-3veUgTYmz-_BvxiaJ9xpN_VJR0iYIcWWaYsKimr6XPJAO6IAxPg_pZcBcw8mUM-hLmy6Kvae8eCM4W0kBova_w58eW8sQVDPysQAiehIGNOxBty5eQM6UID1zGIgJrLuufOOGkgV_YcCyT6ScCuSGgqtZlkhH-OH3kSOH_Qw/s320/Screenshot_20220712-133813_OneDrive.webp&quot; width=&quot;233&quot; /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Author of the book :&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;span&gt;Madan S Pathania, Br Puri, Lr Sharma&lt;/span&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220712_133554_448.sdocx--&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Details about book :&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;ul style=&quot;background-color: white; border: 0px; box-sizing: border-box; color: #212121; font-family: Lusitana, serif; list-style-image: initial; list-style-position: initial; margin: 0px 0px 1.5em 3em; padding: 0px;&quot;&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Quantum Mechanics&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Chemical bonding molecular quantum mechanics&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Group theory&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;molecular spectroscopyhe gaseous state&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;The liquid state: physical properties of liquids&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;The gaseous state part 2: real gases&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;liquid crystals; The mesomorphic States&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;The third law of thermodynamics&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Phase equilibria&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Chemical equilibria&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;The nernst distribution law&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Electrochemistry part 3: electrified inferences&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Electrochemistry part 2: electromotive force of Galvanic cells&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Photochemistry&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Catalysis&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Surface chemistry&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Mass spectrometry&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Macromolecules&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li style=&quot;border: 0px; box-sizing: inherit; margin: 0px; padding: 0px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Irreversible thermodynamics&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;button class=&quot;btn&quot; onclick=&quot;window.open(&#39;             https://drive.google.com/file/d/13WPmy4cDYIO6KDbXzCVLXdri0man9Igv/view?usp=drivesdk &#39;,&#39;_self&#39;);&quot; style=&quot;height: 60px; width: 90px;&quot; type=&quot;reset&quot;&gt;Download&amp;nbsp;&lt;/button&gt;


&lt;br /&gt;

&lt;/span&gt;&lt;/b&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-large;&quot;&gt;Happy Coding 😊.&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/56495143019325755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/07/puri-sharma-pathania-book-pdf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/56495143019325755'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/56495143019325755'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/07/puri-sharma-pathania-book-pdf.html' title='Puri Sharma Pathania book pdf'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGvFoY4NbNNugM1-3veUgTYmz-_BvxiaJ9xpN_VJR0iYIcWWaYsKimr6XPJAO6IAxPg_pZcBcw8mUM-hLmy6Kvae8eCM4W0kBova_w58eW8sQVDPysQAiehIGNOxBty5eQM6UID1zGIgJrLuufOOGkgV_YcCyT6ScCuSGgqtZlkhH-OH3kSOH_Qw/s72-c/Screenshot_20220712-133813_OneDrive.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-4663227940745982822</id><published>2022-07-08T18:44:00.003+05:30</published><updated>2022-07-10T14:21:39.491+05:30</updated><title type='text'>C++ Mcq </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Type - MCQs&amp;nbsp; :&amp;nbsp;C++ Multiple Choice Questions&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/h1&gt;&lt;/div&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;
  
  &lt;h16&gt;
 &lt;script&gt;
function myFun16()
{window.alert(&quot;c is the correct answer&quot;);}
&lt;/script&gt;
  &lt;/h16&gt;
&lt;/b&gt;&lt;form&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
  
1.&amp;nbsp;Which of the following can be considered as the correct syntax for declaring an array of pointers of integers that has a size of 10 in C++&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/h4&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;
a.&lt;input name=&quot;r11&quot; type=&quot;radio&quot; /&gt;int arr = new int[10];   &lt;br /&gt;
b.&lt;input name=&quot;r11&quot; type=&quot;radio&quot; /&gt;   int *arr = new int*[10];   &lt;br /&gt;
c.&lt;input name=&quot;r11&quot; type=&quot;radio&quot; /&gt; int **arr = new int*[10];   &lt;br /&gt;
d.&lt;input name=&quot;r11&quot; type=&quot;radio&quot; /&gt; int *arr = new int[10]; &lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/form&gt;
&lt;div id=&quot;my16&quot;&gt;
&lt;/div&gt;
&lt;b&gt;&lt;button onclick=&quot;myFun16();&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Check Answer 1&lt;/span&gt;&lt;/button&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h17&gt;
&lt;script&gt;
function myFun17()
{window.alert(&quot;c is the correct answer&quot;);}
&lt;/script&gt;
&lt;/h17&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/b&gt;&lt;form&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
2. Which of the following can be considered as the members that can be inherited but not accessible in any class&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;
a.&lt;input name=&quot;r14&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Public&lt;br /&gt;
b.&lt;input name=&quot;r14&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Private&lt;br /&gt;
c.&lt;input name=&quot;r14&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Protected&lt;br /&gt;
d.&lt;input name=&quot;r14&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Both A and C.&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/form&gt;
&lt;div id=&quot;my17&quot;&gt;
&lt;/div&gt;
&lt;b&gt;&lt;button onclick=&quot;myFun17();&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Check Answer 2&lt;/span&gt;&lt;/button&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h18&gt;
&lt;script&gt;
function myFun18()
{window.alert(&quot;c is the correct answer&quot;);}
&lt;/script&gt;
&lt;/h18&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
3. Which of the following is used for implementing the late binding&lt;/span&gt;&lt;/h4&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;
a.&lt;input name=&quot;r13&quot; type=&quot;radio&quot; /&gt;Operator Functions&lt;br /&gt;
b.&lt;input name=&quot;r13&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Constant&lt;span style=&quot;font-family: Arial;&quot;&gt;&amp;nbsp;Functions&lt;/span&gt;&lt;br /&gt;
c.&lt;input name=&quot;r13&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Virtual&amp;nbsp;Functions&lt;br /&gt;
d.&lt;input name=&quot;r13&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Both A and B.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;my18&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;button onclick=&quot;myFun18();&quot;&gt;Check Answer 3&lt;/button&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/b&gt;
&lt;br /&gt;&lt;/span&gt;
&lt;h19&gt;
&lt;script&gt;
function myFun19()
{window.alert(&quot;a is the correct answer&quot;);}
&lt;/script&gt;
&lt;/h19&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;form&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
4. Which of the following is not a kind of inheritance?&lt;/span&gt;&lt;/h4&gt;&lt;/form&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;
a.&lt;input name=&quot;r14&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Distributed&lt;br /&gt;
b.&lt;input name=&quot;r14&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Multiple&lt;br /&gt;
c.&lt;input name=&quot;r14&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Multl-level&lt;br /&gt;
d.&lt;input name=&quot;r14&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Hierarchal&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;div id=&quot;my19&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;button onclick=&quot;myFun19();&quot;&gt;Check Answer 4&lt;/button&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h20&gt;
&lt;script&gt;
function myFun20()
{window.alert(&quot;d is the correct answer&quot;);}
&lt;/script&gt;
&lt;/h20&gt;

&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;form&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;
5. Which type of approach is used by the C++ language.&amp;nbsp;&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;
a.&lt;input name=&quot;r15&quot; type=&quot;radio&quot; /&gt;Right to left&lt;br /&gt;
b.&lt;input name=&quot;r15&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Left to right&lt;br /&gt;
c.&lt;input name=&quot;r15&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Top to bottom&lt;br /&gt;
d.&lt;input name=&quot;r15&quot; type=&quot;radio&quot; /&gt;&amp;nbsp;Bottom-up&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/form&gt;
&lt;div id=&quot;my20&quot;&gt;
&lt;/div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;button onclick=&quot;myFun20();&quot;&gt;Check Answer 5&lt;/button&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;span style=&quot;font-size: 13.3333px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;

&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
Please, write your score in the comment box.&lt;br /&gt;&lt;br /&gt;
Hope you enjoy the session, so may sign-up for free to get latest updates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thankyou.

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/4663227940745982822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/07/c-mcq.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/4663227940745982822'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/4663227940745982822'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/07/c-mcq.html' title='C++ Mcq '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-2363502784018025461</id><published>2022-07-04T10:54:00.007+05:30</published><updated>2022-07-10T14:15:59.954+05:30</updated><title type='text'>constructor and destructor in cpp</title><content type='html'>

&lt;script src=&quot;https://gist.github.com/khushpreet-007/1bb18c375d1c2d93a7e0ed4d0b40a1c1.js&quot;&gt;&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/2363502784018025461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/07/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/2363502784018025461'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/2363502784018025461'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/07/blog-post.html' title='constructor and destructor in cpp'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-1104425642197719568</id><published>2022-06-11T22:13:00.002+05:30</published><updated>2022-06-11T22:13:44.723+05:30</updated><title type='text'>Assign Tasks</title><content type='html'>&lt;h1&gt;Assign Tasks Geeks For Geeks&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s664/Screenshot_20210912-144822_Chrome.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;664&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s320/Screenshot_20210912-144822_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;br /&gt;
&lt;hr color=&quot;red&quot; /&gt;
&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;hr color=&quot;green&quot; /&gt;
&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Example 1&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;pre style=&quot;background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-size: 18px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Input:&lt;/span&gt;
N = 3
A = [6, 3, 6]
B = [2, 6, 8]
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Output: &lt;/span&gt;2
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Explanation:&lt;/span&gt; Assign 1st task to 2nd person,
2nd task to 1st person and 3rd task to 3rd person.
Days taken by 1st, 2nd and 3rd person will be:
2, 1, 1.&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Example 2&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;pre style=&quot;background-color: whitesmoke; border-radius: 4px; border: 1px solid rgb(204, 204, 204); box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 13px; line-height: 1.42857; margin-bottom: 10px; margin-top: 0px; overflow-wrap: break-word; overflow: auto; padding: 9.5px; word-break: break-all;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-size: 18px;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Input:&lt;/span&gt;
N = 2
A = [100, 100]
B = [1, 200]
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Output: &lt;/span&gt;100
&lt;span style=&quot;box-sizing: border-box; font-weight: 700;&quot;&gt;Explanation:&lt;/span&gt; Since the work required by both
tasks is same, we can assign them in any order&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// Initial Template for C++&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;bits/stdc++.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;std&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// User function Template for C++&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt;&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;solve&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;, &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;B&lt;/span&gt;[])&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;C&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sort&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sort&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;B&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;B&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;flag&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;max&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;count&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;flag&lt;/span&gt; &amp;gt; &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;max&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;] - &lt;span style=&quot;color: #9cdcfe;&quot;&gt;B&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;] &amp;lt; &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;] = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;else&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;] = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;] - &lt;span style=&quot;color: #9cdcfe;&quot;&gt;B&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // count++;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;] &amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;max&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;max&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // cout&amp;lt;&amp;lt;max&amp;lt;&amp;lt;&quot; &quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // cout&amp;lt;&amp;lt;max&amp;lt;&amp;lt;&quot; &quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;max&lt;/span&gt; &amp;lt;= &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;flag&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;count&lt;/span&gt;++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;count&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;--)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;arr&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;], &lt;span style=&quot;color: #9cdcfe;&quot;&gt;brr&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;arr&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;brr&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ob&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ob&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;solve&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;arr&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;brr&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;
  

&lt;a href=&quot;https://www.amazon.in/b?_encoding=UTF8&amp;amp;tag=ourshopkeeper-21&amp;amp;linkCode=ur2&amp;amp;linkId=02ef70674ac2012838805d1abf2ef7ba&amp;amp;camp=3638&amp;amp;creative=24630&amp;amp;node=1388921031&quot; target=&quot;_blank&quot;&gt;best gaming headphones&lt;/a&gt;




&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://www.amazon.in/b?_encoding=UTF8&amp;amp;tag=ourshopkeeper-21&amp;amp;linkCode=ur2&amp;amp;linkId=02ef70674ac2012838805d1abf2ef7ba&amp;amp;camp=3638&amp;amp;creative=24630&amp;amp;node=1388921031&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;Happy Coding 😊.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/1104425642197719568/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/06/assign-tasks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/1104425642197719568'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/1104425642197719568'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/06/assign-tasks.html' title='Assign Tasks'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s72-c/Screenshot_20210912-144822_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-5883001324251391427</id><published>2022-06-09T16:24:00.005+05:30</published><updated>2022-06-09T16:36:17.226+05:30</updated><title type='text'>Share and Earn </title><content type='html'>&lt;h1&gt;Share and Earn&amp;nbsp;&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s664/Screenshot_20210912-144822_Chrome.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;664&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s320/Screenshot_20210912-144822_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;br /&gt;

&lt;hr color=&quot;red&quot; /&gt;

&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Hey friends! It’s time to steer your career in the right direction with Internshala Trainings and grab a prestigious summer training certificate recognized by your college and *1,00,000+* companies. Choose from a list of *70+* online courses like Digital Marketing, Web Development, Programming with Python, to become career-ready in just 4-8 weeks! *The best part?* You will get up to *Rs 350+55%* discount on all courses through my link along with 1:1 doubt solving, free placement assistance, and hands-on practice!&amp;nbsp; So hurry up, upskill yourself now - https://internshala.com/i/TC-ISP30KHUSH88473.&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Click on the below button and Earn now 😎😎&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://internshala.com/people-for-pride?utm_source=share_copylink&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;Earn At home 😊.&lt;/span&gt;&lt;/p&gt;
  
  
  
  Hey friends! It’s time to steer your career in the right direction with Internshala Trainings and grab a prestigious summer training certificate recognized by your college and *1,00,000+* companies. Choose from a list of *70+* online courses like Digital Marketing, Web Development, Programming with Python, to become career-ready in just 4-8 weeks! *The best part?* You will get up to *Rs 350+55%* discount on all courses through my link along with 1:1 doubt solving, free placement assistance, and hands-on practice!  So hurry up, upskill yourself now - https://internshala.com/i/TC-ISP30KHUSH88473. 
  
  
  
  
  
  &lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/5883001324251391427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/06/share-and-earn.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5883001324251391427'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5883001324251391427'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/06/share-and-earn.html' title='Share and Earn '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s72-c/Screenshot_20210912-144822_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-8062398416318427790</id><published>2022-06-06T16:32:00.003+05:30</published><updated>2022-06-06T16:32:40.383+05:30</updated><title type='text'>Kth smallest element</title><content type='html'>&lt;h1&gt;Given an array arr[] and an integer K where K is smaller than size of array, the task is to find the Kth smallest element in the given array. It is given that all array elements are distinct.&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s664/Screenshot_20210912-144822_Chrome.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;664&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s320/Screenshot_20210912-144822_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;br /&gt;
&lt;hr color=&quot;red&quot; /&gt;
&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;hr color=&quot;green&quot; /&gt;
&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;//Initial function template for C++&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;bits/stdc++.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;std&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;//User function template for C++&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // arr : given array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // l : starting index of the array i.e 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // r : ending index of the array i.e size-1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // k : find kth smallest element and return using this function&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;kthSmallest&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;arr&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;l&lt;/span&gt;, &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;r&lt;/span&gt;, &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;k&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; ans;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sort&lt;/span&gt;(arr, arr+r+&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; i=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; i&amp;lt;=r; i++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(i+&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;==k){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ans = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;arr&lt;/span&gt;[i];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; ans;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; test_case;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;test_case;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt;(test_case--)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; number_of_elements;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;number_of_elements;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[number_of_elements];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; i=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;i&amp;lt;number_of_elements;i++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[i];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; k;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin&amp;gt;&amp;gt;k;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Solution ob;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout&amp;lt;&amp;lt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;ob&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;kthSmallest&lt;/span&gt;(a, &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;, number_of_elements-&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;, k)&amp;lt;&amp;lt;endl;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;span style=&quot;color: #6a9955;&quot;&gt; &amp;nbsp;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;
  

&lt;a href=&quot;https://www.amazon.in/b?_encoding=UTF8&amp;amp;tag=ourshopkeeper-21&amp;amp;linkCode=ur2&amp;amp;linkId=02ef70674ac2012838805d1abf2ef7ba&amp;amp;camp=3638&amp;amp;creative=24630&amp;amp;node=1388921031&quot; target=&quot;_blank&quot;&gt;best gaming headphones&lt;/a&gt;




&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;Happy Coding 😊.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/8062398416318427790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/06/kth-smallest-element.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/8062398416318427790'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/8062398416318427790'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/06/kth-smallest-element.html' title='Kth smallest element'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s72-c/Screenshot_20210912-144822_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-1726399353208646491</id><published>2022-05-28T22:19:00.005+05:30</published><updated>2022-06-01T12:44:07.165+05:30</updated><title type='text'>Equilibrium Point</title><content type='html'>&lt;h1&gt;Given an array A of n positive numbers. The task is to find the first Equilibium Point in the array.&amp;nbsp;&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Equilibrium Point in an array is a position such that the sum of elements before it is equal to the sum of elements after it.&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s664/Screenshot_20210912-144822_Chrome.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;664&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s320/Screenshot_20210912-144822_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;br /&gt;
&lt;hr color=&quot;red&quot; /&gt;
&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;hr color=&quot;green&quot; /&gt;
&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;std&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt;&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;public:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // Function to find equilibrium point in the array.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // a: input array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // n: size of array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;equilibriumPoint&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;start&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;], &lt;span style=&quot;color: #9cdcfe;&quot;&gt;end&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt; - &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt; - &lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;index&lt;/span&gt; = -&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // cout &amp;lt;&amp;lt; a[n - 1] &amp;lt;&amp;lt; a[n - 2];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt; &amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;start&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;end&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;start&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;start&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;cout &amp;lt;&amp;lt; start &amp;lt;&amp;lt; &quot; &quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp; &amp;nbsp; cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &quot; &quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;if ((start == end) &amp;amp;&amp;amp; ((j - i) == 2))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // index = i;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;start&lt;/span&gt; &amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;end&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;end&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;end&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // cout &amp;lt;&amp;lt; end &amp;lt;&amp;lt; &quot; &quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; j &amp;lt;&amp;lt; &quot; &quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;--;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp; &amp;nbsp;if ((start == end) &amp;amp;&amp;amp; ((j - i) == 2))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp; &amp;nbsp;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp; &amp;nbsp; &amp;nbsp; index = i;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &quot; &quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;start&lt;/span&gt; == &lt;span style=&quot;color: #9cdcfe;&quot;&gt;end&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;cout &amp;lt;&amp;lt; i;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (((&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt; - &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;) &amp;lt;= &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;) &amp;amp;&amp;amp; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt; &amp;gt;= &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;))&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;index&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; + &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &quot; &quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;start&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;start&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;cout &amp;lt;&amp;lt; &quot; &quot;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;cout &amp;lt;&amp;lt; index;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt; == &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;index&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;index&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; // taking testcases&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;--)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // taking input n&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;];&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // adding elements to the array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ob&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // calling equilibriumPoint() function&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ob&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;equilibriumPoint&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;) &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;endl&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;
  

&lt;a target=&quot;_blank&quot; href=&quot;https://www.amazon.in/b?_encoding=UTF8&amp;tag=ourshopkeeper-21&amp;linkCode=ur2&amp;linkId=02ef70674ac2012838805d1abf2ef7ba&amp;camp=3638&amp;creative=24630&amp;node=1388921031&quot;&gt;best gaming headphones&lt;/a&gt;




&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;Happy Coding 😊.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/1726399353208646491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/equilibrium-point.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/1726399353208646491'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/1726399353208646491'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/equilibrium-point.html' title='Equilibrium Point'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s72-c/Screenshot_20210912-144822_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-5005054119227453559</id><published>2022-05-28T21:28:00.000+05:30</published><updated>2022-05-28T21:28:49.907+05:30</updated><title type='text'>Array Subset of another array</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;Given two arrays: a1[0..n-1] of size n and a2[0..m-1] of size m. Task is to check whether a2[] is a subset of a1[] or not. Both the arrays can be sorted or unsorted..&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s664/Screenshot_20210912-144822_Chrome.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;664&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s320/Screenshot_20210912-144822_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;br /&gt;
&lt;hr color=&quot;red&quot; /&gt;
&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;hr color=&quot;green&quot; /&gt;
&lt;br /&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;bits/stdc++.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;std&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;isSubset&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a1&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a2&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;, &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;) ;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;--) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a1&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;], &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a2&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;];&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a1&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a2&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;isSubset&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a1&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a2&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;) &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;endl&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #4ec9b0;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;isSubset&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a1&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a2&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;, &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;string&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;count&lt;/span&gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a1&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;]==&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a2&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;]){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;count&lt;/span&gt;++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;count&lt;/span&gt; == &lt;span style=&quot;color: #9cdcfe;&quot;&gt;m&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;Yes&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;else&lt;/span&gt; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;No&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;s&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;Happy Coding 😊.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/5005054119227453559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/array-subset-of-another-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5005054119227453559'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5005054119227453559'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/array-subset-of-another-array.html' title='Array Subset of another array'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s72-c/Screenshot_20210912-144822_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-3116160967020160615</id><published>2022-05-25T15:45:00.000+05:30</published><updated>2022-05-25T15:45:08.780+05:30</updated><title type='text'>Leaders in an array</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;Given an array A of positive integers. Your task is to find the leaders in the array. An element of the array is a leader if it is greater than or equal to all the elements to its right side. The rightmost element is always a leader.&lt;/h1&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s664/Screenshot_20210912-144822_Chrome.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;664&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s320/Screenshot_20210912-144822_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;br /&gt;
&lt;hr color=&quot;red&quot; /&gt;
&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;hr color=&quot;green&quot; /&gt;
&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// C++ program to remove recurring digits from&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// a given number&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;bits/stdc++.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;std&lt;/span&gt;;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; //Function to find the leaders in the array.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;leaders&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[], &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; max =&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[n-&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;vector &amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;gt; v;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push_back&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[n-&lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;]);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; i=n-&lt;span style=&quot;color: #b5cea8;&quot;&gt;2&lt;/span&gt;; i&amp;gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; i--){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[i]&amp;gt;=max){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;max = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[i];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;push_back&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[i]);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sort&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;begin&lt;/span&gt;(), &lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;end&lt;/span&gt;(), &lt;span style=&quot;color: #dcdcaa;&quot;&gt;greater&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; v;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts.&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; t;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;cin &amp;gt;&amp;gt; t;&lt;span style=&quot;color: #6a9955;&quot;&gt;//testcases&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt; (t--)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; n;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cin &amp;gt;&amp;gt; n;&lt;span style=&quot;color: #6a9955;&quot;&gt;//total size of array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[n];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //inserting elements in the array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;long&lt;/span&gt; i =&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;i&amp;lt;n;i++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin &amp;gt;&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[i];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Solution obj;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //calling leaders() function&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; vector&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt;&amp;gt; v = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;obj&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;leaders&lt;/span&gt;(a, n);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //printing elements of the vector&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;auto&lt;/span&gt; it = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;begin&lt;/span&gt;();it!=&lt;span style=&quot;color: #9cdcfe;&quot;&gt;v&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;end&lt;/span&gt;();it++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout &amp;lt;&amp;lt; *it &amp;lt;&amp;lt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot; &quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout &amp;lt;&amp;lt; endl;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; // } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;Happy Coding 😊.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/3116160967020160615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/leaders-in-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/3116160967020160615'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/3116160967020160615'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/leaders-in-array.html' title='Leaders in an array'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s72-c/Screenshot_20210912-144822_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-14583817666941739</id><published>2022-05-24T16:23:00.003+05:30</published><updated>2022-05-24T16:23:49.350+05:30</updated><title type='text'>Minimize the sum of product </title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;You are given two arrays, A and B, of equal size N. The task is to find the minimum value of A[0] * B[0] + A[1] * B[1] +…+ A[N-1] * B[N-1], where shuffling of elements of arrays A and B is allowed.&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s664/Screenshot_20210912-144822_Chrome.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;664&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s320/Screenshot_20210912-144822_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;br /&gt;
&lt;hr color=&quot;red&quot; /&gt;
&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;hr color=&quot;green&quot; /&gt;
&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;bits/stdc++.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;std&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;], &lt;span style=&quot;color: #9cdcfe;&quot;&gt;b&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;b&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sort&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sort&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;b&lt;/span&gt;, &lt;span style=&quot;color: #9cdcfe;&quot;&gt;b&lt;/span&gt; + &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;);&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt; - &lt;span style=&quot;color: #b5cea8;&quot;&gt;1&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; = &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt; &amp;lt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt; = &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt; + (&lt;span style=&quot;color: #9cdcfe;&quot;&gt;a&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;] * &lt;span style=&quot;color: #9cdcfe;&quot;&gt;b&lt;/span&gt;[&lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;]);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;j&lt;/span&gt;--;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;Happy Coding 😊.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/14583817666941739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/minimize-sum-of-product.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/14583817666941739'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/14583817666941739'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/minimize-sum-of-product.html' title='Minimize the sum of product '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s72-c/Screenshot_20210912-144822_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-4516994103105009461</id><published>2022-05-24T15:40:00.004+05:30</published><updated>2022-05-24T15:40:26.535+05:30</updated><title type='text'>Check if two arrays are equal or not</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;Given two arrays A and B of equal size N, the task is to find if given arrays are equal or not. Two arrays are said to be equal if both of them contain same set of elements, arrangements (or permutation) of elements may be different though&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s664/Screenshot_20210912-144822_Chrome.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;664&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s320/Screenshot_20210912-144822_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;br /&gt;
&lt;hr color=&quot;red&quot; /&gt;
&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;hr color=&quot;green&quot; /&gt;
&lt;br /&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;div style=&quot;background-color: #1e1e1e; color: #d4d4d4; font-family: Consolas, &amp;quot;Courier New&amp;quot;, monospace; font-size: 14px; line-height: 19px; white-space: pre;&quot;&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;//Initial function template for C++&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&amp;lt;bits/stdc++.h&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;using&lt;/span&gt; &lt;span style=&quot;color: #569cd6;&quot;&gt;namespace&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;std&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #c586c0;&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;ll&lt;/span&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt; long long &lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;//User function template for C++&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;class&lt;/span&gt; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;public:&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; //Function to check if two arrays are equal or not.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;bool&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;check&lt;/span&gt;(&lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;ll&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;, &lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;ll&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;B&lt;/span&gt;, &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;N&lt;/span&gt;) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;bool&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt; =&lt;span style=&quot;color: #569cd6;&quot;&gt;false&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sort&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;begin&lt;/span&gt;(), &lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;end&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;sort&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;B&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;begin&lt;/span&gt;(), &lt;span style=&quot;color: #9cdcfe;&quot;&gt;B&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;end&lt;/span&gt;());&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;count&lt;/span&gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;N&lt;/span&gt;; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;]&lt;/span&gt;==&lt;span style=&quot;color: #9cdcfe;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;]&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;count&lt;/span&gt;++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;if&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;count&lt;/span&gt; == &lt;span style=&quot;color: #9cdcfe;&quot;&gt;N&lt;/span&gt;){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt; = &lt;span style=&quot;color: #569cd6;&quot;&gt;true&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ans&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;// { Driver Code Starts.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;main&lt;/span&gt;()&lt;/div&gt;&lt;div&gt;&amp;nbsp;{&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;while&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;t&lt;/span&gt;--) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #569cd6;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;vector&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #569cd6;&quot;&gt;ll&lt;/span&gt;&amp;gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;arr&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;,&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;),&lt;span style=&quot;color: #9cdcfe;&quot;&gt;brr&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;,&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // increase the count of elements in first array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;ll&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;arr&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;]&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // iterate through another array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // and decrement the count of elements&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // in the map in which frequency of elements&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #6a9955;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // is stored for first array&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;for&lt;/span&gt;(&lt;span style=&quot;color: #569cd6;&quot;&gt;ll&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;=&lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&amp;lt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;++)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cin&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;brr&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #9cdcfe;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #dcdcaa;&quot;&gt;]&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #4ec9b0;&quot;&gt;Solution&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ob&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;cout&lt;/span&gt; &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #9cdcfe;&quot;&gt;ob&lt;/span&gt;.&lt;span style=&quot;color: #dcdcaa;&quot;&gt;check&lt;/span&gt;(&lt;span style=&quot;color: #9cdcfe;&quot;&gt;arr&lt;/span&gt;,&lt;span style=&quot;color: #9cdcfe;&quot;&gt;brr&lt;/span&gt;,&lt;span style=&quot;color: #9cdcfe;&quot;&gt;n&lt;/span&gt;) &lt;span style=&quot;color: #dcdcaa;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #d7ba7d;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #ce9178;&quot;&gt;&quot;&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #c586c0;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #b5cea8;&quot;&gt;0&lt;/span&gt;;&lt;/div&gt;&lt;div&gt;}&lt;span style=&quot;color: #6a9955;&quot;&gt; &amp;nbsp;// } Driver Code Ends&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #0000ee;&quot;&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;color: #0000ee;&quot;&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;Happy Coding 😊.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/4516994103105009461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/check-if-two-arrays-are-equal-or-not.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/4516994103105009461'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/4516994103105009461'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/check-if-two-arrays-are-equal-or-not.html' title='Check if two arrays are equal or not'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s72-c/Screenshot_20210912-144822_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-6515439221310853210</id><published>2022-05-23T21:27:00.002+05:30</published><updated>2022-05-23T21:27:44.158+05:30</updated><title type='text'>Binary Search (GFG)</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;Given a sorted array of size N and an integer K, find the position at which K is present in the array using binary search.&lt;/h1&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s664/Screenshot_20210912-144822_Chrome.webp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;363&quot; data-original-width=&quot;664&quot; height=&quot;175&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s320/Screenshot_20210912-144822_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;br /&gt;
&lt;hr color=&quot;red&quot; /&gt;
&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;hr color=&quot;green&quot; /&gt;
&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;// { Driver Code Starts&lt;/div&gt;&lt;div&gt;// Initial template for C++&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &amp;lt;bits/stdc++.h&amp;gt;&lt;/div&gt;&lt;div&gt;using namespace std;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp;// } Driver Code Ends&lt;/div&gt;&lt;div&gt;// User function template for C++&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;class Solution {&lt;/div&gt;&lt;div&gt;&amp;nbsp; public:&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; long long int binarysearch(int arr[], int n, int k) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; long long int l = 0, r = n - 1, mid, ans;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; while (l &amp;lt;= r)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mid = (r - l) / 2 + l;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (arr[mid] == k)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ans = mid;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = n;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if (arr[mid] &amp;gt; k)&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; r--;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l++;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;int ans2=-1;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; if(ans == mid){&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ans2 = ans;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;return ans2;}&lt;/div&gt;&lt;div&gt;};&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;// { Driver Code Starts.&lt;/div&gt;&lt;div&gt;int main() {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; int t;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; cin &amp;gt;&amp;gt; t;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; while (t--) {&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int N;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin &amp;gt;&amp;gt; N;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int arr[N];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; N; i++) cin &amp;gt;&amp;gt; arr[i];&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int key;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cin &amp;gt;&amp;gt; key;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Solution ob;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int found = ob.binarysearch(arr, N, key);&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cout &amp;lt;&amp;lt; found &amp;lt;&amp;lt; endl;&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&amp;nbsp; // } Driver Code Ends&lt;/div&gt;&lt;/div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/h4&gt;&lt;div&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;Happy Coding 😊.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/6515439221310853210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/binary-search.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/6515439221310853210'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/6515439221310853210'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/binary-search.html' title='Binary Search (GFG)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyWWq5n3J44MXTrJkNs4N4QeREXgTsZ7l16CMnKFkhXMHFBaiPxsqRXgEoCBDdJT1cShcrRyUhumyoH5TzoRA0RIYxK5T6auq8ubvUr72rZBHeIU6fTqqV0KbFWDOJ4cC4n1bo2fDa6xu-L8bgNgIabjcsQ2HS8K6QriRDbm6BDG4YH2pmV1Thqg/s72-c/Screenshot_20210912-144822_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-5421268616932264896</id><published>2022-05-05T16:39:00.002+05:30</published><updated>2022-07-10T21:55:36.621+05:30</updated><title type='text'>How to install IBM SPSS Statistics 26</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;How to install IBM SPSS Statistics 26 (for free)&lt;/span&gt;&lt;/h1&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPjw6Wn2JcavzvObHu4LTH-dLaB9UXh3J64dU3MuvcIGNSdeYSXhILlaXHIfW2bKCBqPFmyfiHaCna-li-Id56CroCtLbIdXsHziZWF64shhzW6nseYycwDMndmMM71VcfaG2jfw8g1-_rooJR312xiRtMLsfLazlTqPzPLJ9vN5hnu0oCOj-JVQ/s714/Screenshot_20220505-161223_Chrome.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;428&quot; data-original-width=&quot;714&quot; height=&quot;192&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPjw6Wn2JcavzvObHu4LTH-dLaB9UXh3J64dU3MuvcIGNSdeYSXhILlaXHIfW2bKCBqPFmyfiHaCna-li-Id56CroCtLbIdXsHziZWF64shhzW6nseYycwDMndmMM71VcfaG2jfw8g1-_rooJR312xiRtMLsfLazlTqPzPLJ9vN5hnu0oCOj-JVQ/s320/Screenshot_20220505-161223_Chrome.webp&quot; width=&quot;320&quot; /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;

&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;hr color=&quot;red&quot; /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;hr color=&quot;green&quot; /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Things keep in mind while downloading IBM spss statistics :&amp;nbsp;&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span&gt;Turn off your internet otherwise software will not activated.&lt;/span&gt;&lt;br /&gt;
&lt;span&gt;Turn off window defender Protection.&lt;/span&gt;&lt;br /&gt;
&lt;span&gt;Turn off any other anti-virus.&lt;/span&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161646_253.sdocx--&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Steps to download IBM&amp;nbsp; statistics Spss 26:&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Download Spss by click on the button given&amp;nbsp; below:&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://bit.ly/3OuZRlD&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;168&quot; data-original-width=&quot;435&quot; height=&quot;124&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6VHwUyE4W7D-WtFVTxeszEMnYWOnrdS-YtA2VJdQdTNzA2tIDsUtGZplqtBcL-GD5VS-deHHGJHWjOzqg6o4_jAa6UNtaf76mD2G8JmZL_2EzMosoGAb2uAXvST8y6HsIUhii-_l8uyeRU9RVxAaiG6UK31o3pimhJXyX3HnsYpdnPws7kNjXcg/s320/Screenshot_20210607-083433_Chrome%20(1).webp&quot; width=&quot;320&quot; /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Install IBM statistics Spss 26:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirqNg6-cm_kYBhBEl5-FCloBnB-i3c-fRA0InRcgLmfrwRyYFrs4gPGX4u5ePc_kgLEP9nv0oBGe609hmrWb02oyAXUpB7JQxYj4_dgz4cuaZb5UFg3XuuRCwG752La3e0SntZdZQbQI1kmRug-0R0H0wknuXEm1r-Z7UrQryOzatt-P4JMPpLuw/s455/Screenshot_20220505-160427_OneDrive.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;431&quot; data-original-width=&quot;455&quot; height=&quot;303&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirqNg6-cm_kYBhBEl5-FCloBnB-i3c-fRA0InRcgLmfrwRyYFrs4gPGX4u5ePc_kgLEP9nv0oBGe609hmrWb02oyAXUpB7JQxYj4_dgz4cuaZb5UFg3XuuRCwG752La3e0SntZdZQbQI1kmRug-0R0H0wknuXEm1r-Z7UrQryOzatt-P4JMPpLuw/s320/Screenshot_20220505-160427_OneDrive.webp&quot; width=&quot;320&quot; /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Click on setup and run as administrator&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3tHncDIrEcuF2D2qJEjwYlI1Vv2FddQYz01LY1uMmEtaRi0p36VSSMZCY4p7dW7AMIBLB15DVqhyeaO8ga75o3kLH1kcbpox3XbzbPNHaFKr3iARLDig3AoC9ODIOzJXTWV97RY2338uILUK8PW04P8dO0UpeTuz-cRX7rP685B2roBz1_xA1AQ/s680/Screenshot_20220505-160451_OneDrive.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;529&quot; data-original-width=&quot;680&quot; height=&quot;249&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3tHncDIrEcuF2D2qJEjwYlI1Vv2FddQYz01LY1uMmEtaRi0p36VSSMZCY4p7dW7AMIBLB15DVqhyeaO8ga75o3kLH1kcbpox3XbzbPNHaFKr3iARLDig3AoC9ODIOzJXTWV97RY2338uILUK8PW04P8dO0UpeTuz-cRX7rP685B2roBz1_xA1AQ/s320/Screenshot_20220505-160451_OneDrive.webp&quot; width=&quot;320&quot; /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;Copy lserver file&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicaQcJAp-i6b7QDsI6NEgGptJzjrkjbWWy2onEXpJJwWU14tlnnUAaqzqvtPviTt4Mu856INsR6b6vRkzbqk3vL5iKCFPsnHiOAgvC3MJvZzeCcWoV-hv8JQZwqo0J3fx0aK149GXeNuzsezLnTRfe3sXgH4cy0AMSqyEwKVVpfNXvp6ENtIUxmw/s719/Screenshot_20220505-160515_OneDrive.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;523&quot; data-original-width=&quot;719&quot; height=&quot;233&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicaQcJAp-i6b7QDsI6NEgGptJzjrkjbWWy2onEXpJJwWU14tlnnUAaqzqvtPviTt4Mu856INsR6b6vRkzbqk3vL5iKCFPsnHiOAgvC3MJvZzeCcWoV-hv8JQZwqo0J3fx0aK149GXeNuzsezLnTRfe3sXgH4cy0AMSqyEwKVVpfNXvp6ENtIUxmw/s320/Screenshot_20220505-160515_OneDrive.webp&quot; width=&quot;320&quot; /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span&gt;And paste it in&amp;nbsp;&lt;/span&gt;&lt;span&gt;IBM spss statics 26 folder.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLjWgcl6fcyqwTj_NkU1YjRN2CjFW3H4qH40FHu8RtyvotGzHIMdZSPXsiH_tjksFuIkC_t_9XYhHWjSVsXOUi2Mjk8n-WsvgK9eHUUsn442sLXsYpV6gJ7Oa1wtVVmFISkmos0V2UcRbEybenTiN-VLcpV3qh8Fk8RZ0ii5Ob1DTQRLWlLcvoCQ/s720/Screenshot_20220505-160553_OneDrive.webp&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;374&quot; data-original-width=&quot;720&quot; height=&quot;166&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLjWgcl6fcyqwTj_NkU1YjRN2CjFW3H4qH40FHu8RtyvotGzHIMdZSPXsiH_tjksFuIkC_t_9XYhHWjSVsXOUi2Mjk8n-WsvgK9eHUUsn442sLXsYpV6gJ7Oa1wtVVmFISkmos0V2UcRbEybenTiN-VLcpV3qh8Fk8RZ0ii5Ob1DTQRLWlLcvoCQ/s320/Screenshot_20220505-160553_OneDrive.webp&quot; width=&quot;320&quot; /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Now explore SPSS for free and life time access.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Happy Coding 😊.&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;!--/data/user/0/com.samsung.android.app.notes/files/clipdata/clipdata_bodytext_220505_161742_640.sdocx--&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/5421268616932264896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/install-download-ibm-spss-statistics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5421268616932264896'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5421268616932264896'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2022/05/install-download-ibm-spss-statistics.html' title='How to install IBM SPSS Statistics 26'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPjw6Wn2JcavzvObHu4LTH-dLaB9UXh3J64dU3MuvcIGNSdeYSXhILlaXHIfW2bKCBqPFmyfiHaCna-li-Id56CroCtLbIdXsHziZWF64shhzW6nseYycwDMndmMM71VcfaG2jfw8g1-_rooJR312xiRtMLsfLazlTqPzPLJ9vN5hnu0oCOj-JVQ/s72-c/Screenshot_20220505-161223_Chrome.webp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252381169939701010.post-5800193093013356432</id><published>2021-12-23T20:48:00.003+05:30</published><updated>2021-12-24T21:24:23.010+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Coding"/><category scheme="http://www.blogger.com/atom/ns#" term="cpp"/><category scheme="http://www.blogger.com/atom/ns#" term="Google Adsense"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="mongodb"/><category scheme="http://www.blogger.com/atom/ns#" term="ourshopkeeper"/><title type='text'>Tally App</title><content type='html'>&lt;h1 style=&quot;text-align: left;&quot;&gt;Tally App&lt;/h1&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiOODfAJQ91t7ztyi4_fZ6zKqq_aw3cie7Vpya5-wJnYEXEvaZEGZsmzogAYcOYurpAHAuQIiptSFfcIISLSE96XmL6vhmnw1s9S_8-fL2AqNA6esDBbzyRrr7r0hNCWKC1Aye6tSekLTYWMFWtnyTZ-YkmW53Uca68WpCddWHjdyTSb6y1gDU9Ow=s889&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;889&quot; data-original-width=&quot;587&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiOODfAJQ91t7ztyi4_fZ6zKqq_aw3cie7Vpya5-wJnYEXEvaZEGZsmzogAYcOYurpAHAuQIiptSFfcIISLSE96XmL6vhmnw1s9S_8-fL2AqNA6esDBbzyRrr7r0hNCWKC1Aye6tSekLTYWMFWtnyTZ-YkmW53Uca68WpCddWHjdyTSb6y1gDU9Ow=s320&quot; width=&quot;211&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;



&lt;br /&gt;
&lt;hr color=&quot;red&quot; /&gt;
&lt;marquee&gt;&lt;a href=&quot;https://studyeverthing.blogspot.com/&quot; target=&quot;_blank&quot;&gt;STUDYEVERTHING &lt;/a&gt;
&lt;/marquee&gt;
&lt;br /&gt;
&lt;hr color=&quot;green&quot; /&gt;
&lt;br /&gt;&lt;div&gt;&lt;br /&gt;










&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Main activity&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;background-color: #2b2b2b; color: #a9b7c6; font-family: &amp;quot;JetBrains Mono&amp;quot;, monospace; font-size: 9.8pt;&quot;&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;package &lt;/span&gt;com.example.tallycounter&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;import &lt;/span&gt;androidx.appcompat.app.AppCompatActivity&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;import &lt;/span&gt;android.os.Bundle&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;import &lt;/span&gt;android.view.View&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;import &lt;/span&gt;android.widget.Button&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;import &lt;/span&gt;android.widget.TextView&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;public class &lt;/span&gt;MainActivity &lt;span style=&quot;color: #cc7832;&quot;&gt;extends &lt;/span&gt;AppCompatActivity {&lt;br /&gt;&lt;br /&gt;    &lt;span style=&quot;color: #cc7832;&quot;&gt;private &lt;/span&gt;TextView &lt;span style=&quot;color: #9876aa;&quot;&gt;textView&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;    private &lt;/span&gt;Button &lt;span style=&quot;color: #9876aa;&quot;&gt;increaseBIN&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;    private &lt;/span&gt;Button &lt;span style=&quot;color: #9876aa;&quot;&gt;decreaseBIN&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;    private &lt;/span&gt;Button &lt;span style=&quot;color: #9876aa;&quot;&gt;resetBIN&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #bbb529;&quot;&gt;@Override&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #bbb529;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;protected void &lt;/span&gt;&lt;span style=&quot;color: #ffc66d;&quot;&gt;onCreate&lt;/span&gt;(Bundle savedInstanceState) {&lt;br /&gt;        &lt;span style=&quot;color: #cc7832;&quot;&gt;super&lt;/span&gt;.onCreate(savedInstanceState)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;        &lt;/span&gt;setContentView(R.layout.&lt;span style=&quot;color: #9876aa; font-style: italic;&quot;&gt;activity_main&lt;/span&gt;)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;        &lt;/span&gt;setUI()&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;increaseBIN&lt;/span&gt;.setOnClickListener(&lt;span style=&quot;color: #cc7832;&quot;&gt;new &lt;/span&gt;View.OnClickListener() {&lt;br /&gt;            &lt;span style=&quot;color: #bbb529;&quot;&gt;@Override&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #bbb529;&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;public void &lt;/span&gt;&lt;span style=&quot;color: #ffc66d;&quot;&gt;onClick&lt;/span&gt;(View v) {&lt;br /&gt;                String newText = Integer.&lt;span style=&quot;font-style: italic;&quot;&gt;toString&lt;/span&gt;(Integer.&lt;span style=&quot;font-style: italic;&quot;&gt;parseInt&lt;/span&gt;(&lt;span style=&quot;color: #9876aa;&quot;&gt;textView&lt;/span&gt;.getText().toString()) + &lt;span style=&quot;color: #6897bb;&quot;&gt;1&lt;/span&gt;)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;textView&lt;/span&gt;.setText(newText)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;            &lt;/span&gt;}&lt;br /&gt;        })&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;decreaseBIN&lt;/span&gt;.setOnClickListener(&lt;span style=&quot;color: #cc7832;&quot;&gt;new &lt;/span&gt;View.OnClickListener() {&lt;br /&gt;            &lt;span style=&quot;color: #cc7832;&quot;&gt;public void &lt;/span&gt;&lt;span style=&quot;color: #ffc66d;&quot;&gt;onClick&lt;/span&gt;(View v) {&lt;br /&gt;                &lt;span style=&quot;color: #cc7832;&quot;&gt;if &lt;/span&gt;(Integer.&lt;span style=&quot;font-style: italic;&quot;&gt;parseInt&lt;/span&gt;(&lt;span style=&quot;color: #9876aa;&quot;&gt;textView&lt;/span&gt;.getText().toString()) != &lt;span style=&quot;color: #6897bb;&quot;&gt;0&lt;/span&gt;) {&lt;br /&gt;                    String newText = Integer.&lt;span style=&quot;font-style: italic;&quot;&gt;toString&lt;/span&gt;(Integer.&lt;span style=&quot;font-style: italic;&quot;&gt;parseInt&lt;/span&gt;(&lt;span style=&quot;color: #9876aa;&quot;&gt;textView&lt;/span&gt;.getText().toString()) - &lt;span style=&quot;color: #6897bb;&quot;&gt;1&lt;/span&gt;)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;                    &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;textView&lt;/span&gt;.setText(newText)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;                &lt;/span&gt;}&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        })&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;    &lt;span style=&quot;color: #cc7832;&quot;&gt;public void &lt;/span&gt;&lt;span style=&quot;color: #ffc66d;&quot;&gt;resetTextView&lt;/span&gt;(View view) {&lt;br /&gt;        &lt;span style=&quot;color: #9876aa;&quot;&gt;textView&lt;/span&gt;.setText(&lt;span style=&quot;color: #6a8759;&quot;&gt;&quot;0&quot;&lt;/span&gt;)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;    &lt;span style=&quot;color: #cc7832;&quot;&gt;private void &lt;/span&gt;&lt;span style=&quot;color: #ffc66d;&quot;&gt;setUI&lt;/span&gt;() {&lt;br /&gt;        &lt;span style=&quot;color: #9876aa;&quot;&gt;textView &lt;/span&gt;= findViewById(R.id.&lt;span style=&quot;color: #9876aa; font-style: italic;&quot;&gt;textView&lt;/span&gt;)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;increaseBIN &lt;/span&gt;= findViewById(R.id.&lt;span style=&quot;color: #9876aa; font-style: italic;&quot;&gt;increase&lt;/span&gt;)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;decreaseBIN &lt;/span&gt;= findViewById(R.id.&lt;span style=&quot;color: #9876aa; font-style: italic;&quot;&gt;decrease&lt;/span&gt;)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #9876aa;&quot;&gt;resetBIN &lt;/span&gt;= findViewById(R.id.&lt;span style=&quot;color: #9876aa; font-style: italic;&quot;&gt;reset&lt;/span&gt;)&lt;span style=&quot;color: #cc7832;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc7832;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;string&amp;nbsp;&lt;/h3&gt;&lt;pre style=&quot;background-color: #2b2b2b; color: #a9b7c6; font-family: &amp;quot;JetBrains Mono&amp;quot;, monospace; font-size: 9.8pt;&quot;&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;lt;resources&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;    &amp;lt;string &lt;/span&gt;&lt;span style=&quot;color: #bababa;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #6a8759;&quot;&gt;=&quot;app_name&quot;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;gt;&lt;/span&gt;tally counter&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;lt;/string&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;    &amp;lt;string &lt;/span&gt;&lt;span style=&quot;color: #bababa;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #6a8759;&quot;&gt;=&quot;increase&quot;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;gt;&lt;/span&gt;+&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;lt;/string&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;    &amp;lt;string &lt;/span&gt;&lt;span style=&quot;color: #bababa;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #6a8759;&quot;&gt;=&quot;decrease&quot;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;gt;&lt;/span&gt;-&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;lt;/string&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;    &amp;lt;string &lt;/span&gt;&lt;span style=&quot;color: #bababa;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #6a8759;&quot;&gt;=&quot;reset&quot;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;gt;&lt;/span&gt;Reset&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;lt;/string&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;    &amp;lt;string &lt;/span&gt;&lt;span style=&quot;color: #bababa;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #6a8759;&quot;&gt;=&quot;textView&quot;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;gt;&lt;/span&gt;0&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;lt;/string&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #e8bf6a;&quot;&gt;&amp;lt;/resources&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Hope you find the article useful.&lt;/p&gt;&lt;p&gt;Live working proof.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://www.mediafire.com/file/8u69tjbibo2l1px/Tally+counter.apk/file&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;190&quot; data-original-width=&quot;624&quot; height=&quot;97&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEht6Beq_5LbqyYAkuhMXBlQQYio29EL4ZjIlZW1VdXaoe0Hr8tD94hTjYuTEMQeUQ8Vr-SwVL_yhRN_MQEQ_bHWXvkpMPOSrukOM8eva--1Q8OZB0witSGtyr-1lEMkWVqv20GIEjrOfSbXVzPcQKTsWBoewNdCTnOeNXW2CMF0DSjA9-O5y9vFNg=s320&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &lt;a href=&quot;https://www.mediafire.com/file/8u69tjbibo2l1px/Tally+counter.apk/file&quot; target=&quot;_blank&quot;&gt;download&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='https://studyeverthing.blogspot.com/feeds/5800193093013356432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://studyeverthing.blogspot.com/2021/12/tally-app.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5800193093013356432'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/4252381169939701010/posts/default/5800193093013356432'/><link rel='alternate' type='text/html' href='https://studyeverthing.blogspot.com/2021/12/tally-app.html' title='Tally App'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEiOODfAJQ91t7ztyi4_fZ6zKqq_aw3cie7Vpya5-wJnYEXEvaZEGZsmzogAYcOYurpAHAuQIiptSFfcIISLSE96XmL6vhmnw1s9S_8-fL2AqNA6esDBbzyRrr7r0hNCWKC1Aye6tSekLTYWMFWtnyTZ-YkmW53Uca68WpCddWHjdyTSb6y1gDU9Ow=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry></feed>