tag:blogger.com,1999:blog-77755095670862609922024-03-18T08:29:49.638+05:30Apna Coding AddaUnknownnoreply@blogger.comBlogger36125tag:blogger.com,1999:blog-7775509567086260992.post-8075331107377018152023-06-18T16:36:00.052+05:302024-03-17T12:55:48.303+05:30Products Which I like<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"></link>
</head>
<body>
<div class="container mx-auto text-center">
<!-- Copy and paste card for add another product-->
<div class="card my-2">
<img alt="Image not found" class="card-img-top" src="https://m.media-amazon.com/images/I/71ISIssoVFL._SL1500_.jpg" />
<div class="card-body">
<h5 class="card-title">headphone</h5>
<a class="btn btn-primary" href="https://amzn.to/3x1Qjuk">Buy now</a>
</div>
</div>
</div>
<div class="card my-2">
<img alt="Image not found" class="card-img-top" src="https://m.media-amazon.com/images/I/71Tdji2e5cL._SL1500_.jpg" />
<div class="card-body">
<h5 class="card-title">Camera</h5>
<a class="btn btn-primary" href="https://amzn.to/43jRnWq">Buy now</a>
</div>
</div>
</div>
</body>
</html>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-55265934090948644322022-05-10T23:42:00.001+05:302022-05-10T23:42:32.139+05:30Sliding Window Technique
<html>
<head>
<meta charset="utf-8"></meta>
<meta content="width=device-width, initial-scale=1.0" name="viewport"></meta>
<title>sliding window</title>
<link href="https://stackedit.io/style.css" rel="stylesheet"></link>
</head>
<body class="stackedit">
<div class="stackedit__html"><h2 id="introduction">Introduction</h2>
<p>Sliding window technique is use for reducing some redundant calculation which slow down program. like it can reduce time complexity from O(n^2) to O(n) with O(1) space complexity.</p>
<h2 id="why-use--it">Why use it?</h2>
<p>First of all it reduce time coplexity and also with O(1) space complexity. so let’s understand with Example…<br />
So we want to find maximum sum of k consecutive integer from array, so brute force would look like this for k=5,</p>
<pre><code>#include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> arr = {5,2,6,7,7,3,2,1,3,9};
int final_max = 0;
for(int i=0;i<arr.size()-5;i++){
int temp_max = 0;
for(int j=i;j<i+5;j++){
temp_max += arr[j];
}
if(temp_max>final_max){
final_max = temp_max;
}
}
cout << final_max << endl;
return 0;
}
</code></pre>
<p>But time complexity of above program is O(nk)</p>
<p><strong>Brute Force Approach</strong><br />
<img alt="enter image description here" src="https://i.stack.imgur.com/2Dneo.png" /></p>
<p>As per we can see in above image brute approach checks every patter of k length(here k=5). if you compare above code with this image you will understand it.</p>
<p>here k=5 so it won’t make too much different in O(n) and O(nk) but what if k is too big. then it will impact running time of program, so what to do now? can we implement this above code to O(n)?</p>
<p>Answer is YES!! , with use of sliding window we can reduce time complexity of above code O(n).</p>
<h2 id="how-sliding-window-works">How Sliding Window Works?</h2>
<p>So let’s see how sliding window works.<br />
let me give you simple visual with small array,</p>
<pre><code>{5,2,6,7,7,3,2,1,3,9}
for k=3 (because k=5 is too much to write)
{5,2,6} --> first 3 elements
{2,6,7} --> remove 5 and add 7
{6,7,7} --> remove 2 and add 7
{7,7,3} --> remove 6 and add 3
{7,3,2} --> remove 7 and add 2
{3,2,1} --> remove 7 and add 1
{2,1,3} --> remove 3 and add 3
{1,3,9} --> remove 2 and add 9
</code></pre>
<p>let’s understand with second example,</p>
<pre><code> {5, 7, 1, 4, 3, 6, 2, 9, 2}
k=5
{5,7,1,4,3} --> first 5
{7,1,4,3,6} --> remove 5 and add 6
and so on.
</code></pre>
<p><img alt="enter image description here" src="https://i.stack.imgur.com/F6087.png" /><br />
As we can see in above image it move one step at one time. so this is how actually it works.</p>
<h2 id="lets-code">Let’s Code</h2>
<p>Code for maximum sum of k consecutive integer from array, using sliding window technique.</p>
<pre><code>#include<iostream>
#include<vector>
using namespace std;
int sum_of_k_ele(vector<int> arr,int k){
int sum = 0;
for(int i=0;i<k;i++){
sum += arr[i];
}
return sum;
}
int main(){
vector<int> arr = {5,2,6,7,7,3,2,1,3,9};
int k=3;
// below function will be used only once
// for finding sum of first k digits
int final_sum = sum_of_k_ele(arr,k);
int temp_sum = final_sum;
for (int i=k;i<arr.size();i++){
temp_sum = temp_sum - arr[i-k];
temp_sum = temp_sum + arr[i];
if(temp_sum>final_sum){
final_sum = temp_sum;
}
}
cout << final_sum << endl;
return 0;
}
</code></pre>
<h2 id="when-to-use">When to use?</h2>
<ul>
<li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox" /> When you are looking for subrange in given string or array like highest or smallest value or targeted value.</li>
<li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox" /> it involves data structure which is iterable like string or array.</li>
<li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox" /> when there can be brute force solution with O(n^2) or (2^n)</li>
</ul>
<h2 id="more-examples..">More Examples…</h2>
<ul>
<li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox" /> <a href="https://leetcode.com/problems/find-all-anagrams-in-a-string/">Find all anagrams in a string</a> --> <a href="https://leetcode.com/problems/find-all-anagrams-in-a-string/discuss/1739067/C++-Solution-my-though-Thought-process">Solution</a></li>
<li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox" /> <a href="https://leetcode.com/problems/permutation-in-string/">Permutation in string</a> --> <a href="https://leetcode.com/problems/permutation-in-string/discuss/1762941/C++-Several-Solutions">Solution</a><br />
<strong>Note :</strong> Solutions in above questions are just plain code.</li>
</ul>
<h2 id="references">References</h2>
<ul>
<li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox" /> <a href="https://stackoverflow.com/questions/8269916/what-is-sliding-window-algorithm-examples">Stackoverflow</a></li>
<li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox" /> <a href="https://medium.com/outco/how-to-solve-sliding-window-problems-28d67601a66">medium</a></li>
</ul>
<p>Thank You 😊😊</p>
</div>
</body>
</html>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-15324571355771796482022-05-09T23:15:00.001+05:302022-05-09T23:15:18.032+05:30Pascal's Triangle<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pascal's Triangle</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
<body class="stackedit">
<div class="stackedit__html"><h2 id="introduction">Introduction</h2>
<p>In mathematics, Pascal’s triangle is triangular array of binomial coefficient.<br>
below you can see how it looks like…</p>
<pre><code> 1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
</code></pre>
<h2 id="how-to-build-it">How to Build it?</h2>
<p>First of all start with “1” and second rows as “1 1” then we can clearly see every element in next rows(except 1) if sum of two elements from above row. (i.e, 1+1=2, 1+2=3, 1+3=4) and with this rules we can create pascal’s triangle of n rows.<br>
Below is visual of how it will look like,<br>
<img src="https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif" alt="Pascal's Triangle"></p>
<h2 id="formula">Formula</h2>
<ul>
<li class="task-list-item">
<p><input type="checkbox" class="task-list-item-checkbox" disabled=""> let’s take 0th row as first row and 0th column as first column, so we can get each value using <img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/e8cc51538192fdf193790d4378c3a998a6b94262" alt="nCk"> formula where n is row number and k is column number. so for finding 1st(0 indexed) element in 2nd row we can write 2C1 which will give 2.</p>
</li>
<li class="task-list-item">
<p><input type="checkbox" class="task-list-item-checkbox" disabled=""> There is one another technique, in which we need to solve (x + y)^n for nth row, if we solve (x +y)² then we will get 2nd row as coefficient of x and y in this solved formula which is x² + 2xy + y² . coefficients are (1 ,2 , 1) which is second row in pascal’s triangle.</p>
</li>
</ul>
<h2 id="implementation">Implementation</h2>
<p>So it is time to code let’s see how we can implement it which some different approaches.<br>
Approach 1 : nCr formula</p>
<pre><code>#include<iostream>
using namespace std;
// return Factorial of val
int fact(int val){
int ans = 1;
for(int i=1;i<=val;i++){
ans = ans* i;
}
return ans;
}
// return next value in pascal triangle
int nextval(int row, int col){
int result;
result = fact(row) / (fact(col)* fact(row-col));
return result;
}
int main(){
int n = 5; // creating pascal's triangle of 5 rows
for (int i=0;i<n;i++){
for(int j=0;j<=i;j++){
cout << nextval(i,j) << " ";
}
cout << endl;
}
return 0;
}
</code></pre>
<p>Approach 2: Another Formula</p>
<pre><code>#include<iostream>
using namespace std;
int main(){
int rows = 5;
for (int i=1;i<=rows;i++){
int nCr = 1;
cout << 1 << " ";
for(int j=1;j<i;j++){
nCr = nCr *(i-j)/j;
cout << nCr << " ";
}
cout << endl;
}
return 0;
}
</code></pre>
<p>Approach 3: Using Vector for storing sum of two elements of previous row,</p>
<pre><code>#include<iostream>
#include<vector>
using namespace std;
vector<vector<int>> pascal_triangle(int numRows) {
vector<vector<int>> result(numRows);
for(int i=0;i<numRows;i++){
result[i].resize(i+1);
result[i][0]=result[i][i]=1;
for(int j=1;j<i;j++){
result[i][j] = result[i-1][j] + result[i-1][j-1];
}
}
return result;
}
void print(vector<vector<int>> result){
for(int i=0;i<result.size();i++){
for(int j=0;j<result[i].size();j++){
cout << result[i][j] << " ";
}
cout << endl;
}
}
int main(){
int n=10;
vector<vector<int>> result = pascal_triangle(n);
print(result);
return 0;
}
</code></pre>
<p>Approach 4 : Python3<br>
when we concatenate [1] and [0] like [1] + [0] and [0] + [1] then we get [1,0] and [0,1] , now sum of every element of list1 and list2 will be [1,1] which if second row of pascal triangle now this same process with [1,1] then we’ll get [1,1,0] and [0,1,1] then [1,2,1] , after repeating this process we can get pascal’s triangle of n rows.</p>
<pre><code>def pascal_triangle(numRows):
ans = [[1]]
for _ in range(1,numRows):
a = ans[-1] + [0]
b = [0] + ans[-1]
sum_ab = [x+y for (x,y) in zip(a,b)]
ans.append(sum_ab)
# print(ans)
return ans
result = pascal_triangle(5)
for i in result:
print(i)
</code></pre>
<p>There are still other implementation of pascal’s triangle , if you know any then let me know in comment box.</p>
<h2 id="some-amazing-facts">Some amazing facts</h2>
<ul>
<li class="task-list-item">
<p><input type="checkbox" class="task-list-item-checkbox" disabled=""> if you have noticed if we sum of element in row then we’ll get 2^n , where n is row number in that pascal’s triangle. ( 1 = 2° , 1+1 = 2 , 1+2+1 = 2² )<br>
<img src="https://www.mathsisfun.com/numbers/images/pascals-triangle-doubles.svg" alt="enter image description here"></p>
</li>
<li class="task-list-item">
<p><input type="checkbox" class="task-list-item-checkbox" disabled=""> if we take whole row as one number then it is power of 11, ( 11° = 1, 11 = 1 1, 11² = 1 2 1 )<br>
<img src="https://www.mathsisfun.com/numbers/images/pascals-triangle-11.svg" alt="enter image description here"></p>
</li>
<li class="task-list-item">
<p><input type="checkbox" class="task-list-item-checkbox" disabled=""> Also there are some other patterns in pascal’s triangle which you can see in below image,<br>
<img src="https://www.mathsisfun.com/numbers/images/pascals-triangle-types.svg" alt="enter image description here"></p>
</li>
</ul>
<h2 id="references">References</h2>
<ul>
<li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled=""> <a href="https://www.mathsisfun.com/pascals-triangle.html">https://www.mathsisfun.com/pascals-triangle.html</a></li>
<li class="task-list-item"><input type="checkbox" class="task-list-item-checkbox" disabled=""> <a href="https://en.wikipedia.org/wiki/Pascal%27s_triangle">https://en.wikipedia.org/wiki/Pascal's_triangle</a></li>
</ul>
<p>Thank You 😊😊</p>
</div>
</body>
</html>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-77222998859929375372022-04-16T01:23:00.004+05:302022-04-16T01:23:51.922+05:30What is Docker? <p> Hello Everyone , Today we'll talk about what is docker ?, how to use it ? and why you should use it ?,</p><p>then let's begin...<span></span></p><a name='more'></a><p></p><p>What is Docker ?</p><p>- According to Wikipeadia " Docker is a set of platform as a service (PaaS) products that use OS-level <span> </span>virtualization to deliver software in packages called containers.".</p><p>- Docker provides platform for building project easily. it has images of what you want (like database or OS) and you can perform task on that container and build project with it.</p><p>Didn't Get completely ?</p><p></p><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV8lkQuEzsVwBYjSyVYvG10U214FW6k4n_cDHGBjxyBag_fC19sSxgENr7f1ORYU9HbBv-DRB9acGoMF7ufQokoZBLmOYa1ehhlJtiFj5bBUIkoTUj_vKzw--gebh4JFi7UOs1KwPqV_FTvG_5BgKTnR0J275k-wqMG0W-m9B9Bu40d6yF9a_sDug0/s960/What-to-do-when-your-computer-doesnt-recognize-your-phone.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="554" data-original-width="960" height="185" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV8lkQuEzsVwBYjSyVYvG10U214FW6k4n_cDHGBjxyBag_fC19sSxgENr7f1ORYU9HbBv-DRB9acGoMF7ufQokoZBLmOYa1ehhlJtiFj5bBUIkoTUj_vKzw--gebh4JFi7UOs1KwPqV_FTvG_5BgKTnR0J275k-wqMG0W-m9B9Bu40d6yF9a_sDug0/s320/What-to-do-when-your-computer-doesnt-recognize-your-phone.jpg" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div></div></div><div style="text-align: center;"><u><b><span style="font-size: medium;">it works on my pc then why not on my friend's pc.</span></b></u></div><div style="text-align: left;"><br /></div><div style="text-align: left;">So Docker is solution of this problem.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">How it works and why it is Better than Virtual Machine ?</div><div style="text-align: left;"><br /></div><div style="text-align: left;">- It is Faster and better than VM because when you install image of OS then it won't be downloading <span> </span>kernel for it , docker will use main kernel as new OS's kernel too. but you can not use this on different <span> </span>kernel based system (like ubuntu can not be used in window)</div><div style="text-align: left;"><br /></div><div style="text-align: left;"> - so it just became faster than VM because it use one layer which is of Application. see below image to understand more about it.</div><div style="text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN2CMFfEoSPb-yGFj8gOP3ZPpV5AGGzTkyMNap3UqjjeEgj8mDiEVyKbqXiNXPn257QZuKOgHrJXH7rndtm7JRnTmHZYmhIEoyqPB0NF1xUAQK37RytqyB5FJHyD6de3jsbTNgVFubkuz7iV4ThqOPgzVyT3RUeKSnwwPNjMGI1rrlFd6fRlDBkOLW/s1920/Screenshot%20from%202022-03-30%2003-27-02.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="254" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN2CMFfEoSPb-yGFj8gOP3ZPpV5AGGzTkyMNap3UqjjeEgj8mDiEVyKbqXiNXPn257QZuKOgHrJXH7rndtm7JRnTmHZYmhIEoyqPB0NF1xUAQK37RytqyB5FJHyD6de3jsbTNgVFubkuz7iV4ThqOPgzVyT3RUeKSnwwPNjMGI1rrlFd6fRlDBkOLW/w453-h254/Screenshot%20from%202022-03-30%2003-27-02.png" width="453" /></a></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><br /></div><div style="text-align: left;">How to use Docker ?</div><div style="text-align: left;"><br /></div><div style="text-align: left;">- First install Docker , <a href="https://docs.docker.com/engine/install/" target="_blank">Installation Steps</a></div><div style="text-align: left;">- Go to docker hub and search for any image you want to use</div><div style="text-align: left;">i will be using mysql for demo purpose ,</div><div style="text-align: left;"><br /></div><div style="text-align: left;">type, </div><div style="text-align: left;"><blockquote><b>docker run mysql </b></blockquote></div><div style="text-align: left;">(it will download and run automatically) </div><div style="text-align: left;">still won't run until you set root password for mysql</div><div style="text-align: left;">now type </div><div style="text-align: left;"><b><blockquote>docker run --name mysql_db -d -p 3300:3306 -e MYSQL_ROOT_PASSWORD=mypassword mysql:latest</blockquote></b></div><div style="text-align: left;"><br /></div><div style="text-align: left;">Here , --name assign name to mysql:latest container , -e set up environment variables , -d for detach mode , -p for setting up local-port:docker-port</div><div style="text-align: left;">now check with , </div><div style="text-align: left;"><blockquote><b>docker ps </b></blockquote></div><div style="text-align: left;">Here, ps shows running docker container and if you add -a then it will show all containers</div><div style="text-align: left;">if there is something named mysql_db is running then that's it mysql is running in docker container .</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Now for using mysql in docker type, </div><div style="text-align: left;"><br /></div><div style="text-align: left;"><b></b></div><blockquote><div style="text-align: left;"><b>docker exec -it mysql_db /bin/bash</b></div><div style="text-align: left;"></div></blockquote><div style="text-align: left;"><b><br /></b></div><div style="text-align: left;">Here exec -it will open interactive terminal for mysql</div><div style="text-align: left;">now type, </div><div style="text-align: left;"><blockquote><b>mysql -u root -p mypassword</b></blockquote></div><div style="text-align: left;">now you are done , you can use mysql.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">You are using sql but in docker now you can create project using multiple docker images and deploy them to cloud or you can send to anyone.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">So that was basic knowledge of docker. still want to know more <a href="https://youtu.be/3c-iBn73dDE" target="_blank">watch this video</a></div><div style="text-align: left;"><br /></div><div style="text-align: left;">if you want to see <a href="https://github.com/arth2002/Django-Mysql-Phpmyadmin-on-docker" target="_blank">project(django+mysql+phpmyadmin) related to docker checkout my github</a></div><div style="text-align: left;"><br /></div><div style="text-align: left;">If you are having any trouble in setting-up docker then comment down , i'll try my best to help you.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Thank You 😊😊</div><p></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-52087104868463606082022-03-26T03:01:00.005+05:302022-03-26T03:01:47.254+05:30Makefile<p> You may have seen file named Makefile or you may have type command like make, make install. so what is this file Makefile and what are this command. let's discuss about it.<span></span></p><a name='more'></a><p></p><p>What is Makefile?</p><p>-> Makefile is Magical file which contains some shell command. if you type make {command} then it will execute make file.</p><p>let's dive in little deep,</p><p>create file named <b>Makefile</b> , (use tabs while indentation)</p><p></p><blockquote><p>hello:</p><p><span> echo"hello world"</span></p></blockquote><p>now type <b>make</b> in terminal</p><p>format of Makefile,</p><p></p><blockquote><p>target : prerequisites</p><p><span> command</span><br /></p><p><span><span> command</span></span></p></blockquote><p><span><span></span>where target is command which can be triggered using make.</span></p><p></p><blockquote><p>first: first.o</p><p><span style="white-space: pre;"> </span>cc first.o -o first # third</p><p>first.o: first.c</p><p><span style="white-space: pre;"> </span>cc -c first.c -o first.o # second</p><p>first.c:</p><p><span style="white-space: pre;"> </span>echo "int main() { return 0; }" > first.c # first</p><p>clear:</p><p></p><p><span style="white-space: pre;"> </span>rm -rf first first.o first.c</p></blockquote><p>when we type make, commands in Makefile execute line by line,</p><p>here it started with first(target) then it needed first.o(prerequisite) so now it is finding first.o </p><p>next line it find first.o(target) then it needed first.c (prerequisite) so now it is finding first.c</p><p>next line it find first.c and there are not any prerequisite for it so it will execute command of it</p><p>then it will go up for first.o(target) because it find prerequisite for it which is first.c and execute commands of it then it will go up one more time for first. and this is how it works.</p><p>now if you run <b>make clear</b> it will delete all files which are created.</p><p>Why use Makefile?</p><p>-> when you're working on some project no matter it is big or small but if you use Makefile it will reduce your some work which you need to repeat while you compile your program . also make is used to build executable programs and libraries from source code.</p><p><br /></p><p>Even you can install dependency using Makefile like below,</p><p></p><blockquote><p>packages:</p><p><span style="white-space: pre;"> </span>echo "installing packages"</p><p><span style="white-space: pre;"> </span>sudo apt install {package-name}</p><p>help:</p><p><span style="white-space: pre;"> </span>echo "packages: install all packages"</p></blockquote><p><br /></p><p>There is lot about Makefile which i can't cover in one post, but now you have basic idea of Makefile, so you can create Makefile.</p><p>[Note: there can be some indentation error in above code so you should type it yourself ] </p><p>Thank You 😊😊</p><p></p><p></p>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-7775509567086260992.post-60256851446681234072022-03-22T00:57:00.000+05:302022-03-22T00:57:06.955+05:30Add BUY ME A COFFEE To Your Github/Website<p> Hey Everyone , Today we'll discuss how to add buy me a coffee to your github or website. so let's begin<span></span></p><a name='more'></a><p></p><p><br /></p><p>There are literally two steps of this process:</p><p>Step 1 : Create account <a href="https://www.buymeacoffee.com/" target="_blank">BuyMeACoffee</a> and get your username from it.</p><p>Step 2: Add this to your website</p><p></p><blockquote><a href="https://www.buymeacoffee.com/{yourusername}" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a></blockquote><p> </p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEh7WKu26oia8IzgxzDWcLRoVxsIMuj1ERWFFBmKfsTsPm2tDXcu7vTlSwg2-6HLKVEo9Z1pFUdqwk1Kf8NZtnr2mYRgOLyMgOVAAp03RDC8OlZNMtoQDKC14Jffq9gxkvlJeUeFX0bMnzNycZ85qcwsVlsCl7B9qY0A9m36mPhStjHj9VlcvWJtIBrs" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="100" data-original-width="434" height="74" src="https://blogger.googleusercontent.com/img/a/AVvXsEh7WKu26oia8IzgxzDWcLRoVxsIMuj1ERWFFBmKfsTsPm2tDXcu7vTlSwg2-6HLKVEo9Z1pFUdqwk1Kf8NZtnr2mYRgOLyMgOVAAp03RDC8OlZNMtoQDKC14Jffq9gxkvlJeUeFX0bMnzNycZ85qcwsVlsCl7B9qY0A9m36mPhStjHj9VlcvWJtIBrs" width="320" /></a></div><br /><br /><p></p><p>Now if you want to add to your github then </p><p><span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;"></span></p><blockquote><span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;"><p></span><span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;"><a href="https://www.buymeacoffee.com/</span>{yourusername}<span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;">"> <img align="left" src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" height="50" width="210" alt="</span>{yourusername}<span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;">" /></a></span><span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;"></p><br><br></span></blockquote><span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;"></span><p></p><p><span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;"><br /></span></p><p><span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;"></span></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEi8lSrVEG5NztkVJbR1QuedM9Nc54NVr5lHY0c8fU2s7J5T7aMheiwt-geXOJOZT1mKnrafbfpXmXWXj6Vjd4PhY8DDW8teSkOAYD2PI0eTEk20y6YvZ5IS5Z9nYkhBr2ohd1BTdwpKSPsloXHZjudUjykoF6DkBDG3BoJQPIivCwN-q62Z9H7SSR9R" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="153" data-original-width="545" height="90" src="https://blogger.googleusercontent.com/img/a/AVvXsEi8lSrVEG5NztkVJbR1QuedM9Nc54NVr5lHY0c8fU2s7J5T7aMheiwt-geXOJOZT1mKnrafbfpXmXWXj6Vjd4PhY8DDW8teSkOAYD2PI0eTEk20y6YvZ5IS5Z9nYkhBr2ohd1BTdwpKSPsloXHZjudUjykoF6DkBDG3BoJQPIivCwN-q62Z9H7SSR9R" width="320" /></a></div><br /><br /><p></p><p><span style="background-color: #f7fafc; color: #1a202c; font-family: "Roboto Mono", monospace; font-size: 14px;">So i've created mine so you can buy me a coffee <a href="https://www.buymeacoffee.com/ArthPrajapati" target="_blank">here</a></span></p><p><br /></p><p>Thank You</p><p></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-34350632951100471562022-03-18T18:13:00.002+05:302022-03-18T18:13:41.809+05:30How to make Stylish GitHub Profile readme.md ?<p> Hello Everyone , Today we'll how to make stylish readme.md for your Github profile(not for project)</p><p>let's begin...<span></span></p><a name='more'></a><p></p><p>Github profile readme.md is file which is like your stylish resume , it has your skills , github activities etc.</p><p>Below is sample how it would look.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhJfQM2TSo0G89xwnJNiHYJV3Fr7vMb1yI1GUMQwXiHfRxbr0R3uwyEdyB0g2fTLYkmPnKgysGS5w04-UingVPbGp2Ule22AXHamHnwsXx5xsmqWKLIrNS4sicUF7CWVcSCO2RLkSl_MZq4byMVcMirMGjpfn7cwUWBAsm4RA51iXNpy6Yb2duWvH07=s1920" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1080" data-original-width="1920" height="329" src="https://blogger.googleusercontent.com/img/a/AVvXsEhJfQM2TSo0G89xwnJNiHYJV3Fr7vMb1yI1GUMQwXiHfRxbr0R3uwyEdyB0g2fTLYkmPnKgysGS5w04-UingVPbGp2Ule22AXHamHnwsXx5xsmqWKLIrNS4sicUF7CWVcSCO2RLkSl_MZq4byMVcMirMGjpfn7cwUWBAsm4RA51iXNpy6Yb2duWvH07=w584-h329" width="584" /></a></div><br /><p>It is very easy to make. </p><p><b>Step 1</b>: create repository of your name (ex: i created arth2002)</p><p><span> </span><span> </span><span> </span>now make it public and add readme.md to it</p><p><b>Step 2</b>: go to (<a href="https://rahuldkjain.github.io/gh-profile-readme-generator/">Readme Generator</a>)</p><p><span> </span><span> </span><span> </span>Fill your skill and tools you know </p><p><span> </span><span> </span><span> </span>Then generate readme.md </p><p><b>Step 3</b>: now update your readme.md (paste copied readme.md)</p><p><span> </span><span> </span><span> </span>now commit as "initial commit" </p><p><br /></p><p>Note: There can be some issue in url so just copy original url and paste it in readme.md file</p><p><br /></p><p>Thank You 😊😊</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-13989263974083576032022-02-15T02:04:00.002+05:302022-05-17T14:31:03.153+05:30What is Digital Root ? <p> What is a Digital root? if you have done little competitive programming or practice for Data Structure or anything else you have got a problem where you need to sum all digits of the number and do this process until the number becomes a single-digit number. so that is Digital Root, let's talk about it.<span></span></p><a name='more'></a><p></p><p>So you might have seen digital root , some Example</p><p><b><u>Examples:</u></b></p><p>123 => 1 + 2 + 3 => 6</p><p>455 => 4 + 5 + 5 => 14 => 1+4 = 5 </p><p>So here you can attempt brute force too. but that will be slow. Then how will you solve this problem?</p><p>Some points which we use in the digital root concept(properties),</p><p></p><ul style="text-align: left;"><li>when you multiply any number(>0) by 9 then the sum of all digits of that number will always be 9. Example : 345*9 = 3105 => 3+1+0+5 => 9 , you can check yourself this condition (try different numbers)</li><li>When we add 9 to any number(here add means concatenating ) sum of all digits won't get effected, Example : 345 => 3+4+5 => 12 => 1+2 => 3, now add 9 , 3459 => 21 => 2+1=>3</li><li>when we divide any number by 9, then what remainder we get is the same as the digital root of that number. Example : 15/9 => 6 and 15=> 1+5=>6</li><li>Any Perfect Square's digital root will be 1,4,7,9 (16=>1+6=>7, 36=>3+6=>9 etc)</li></ul><p><br /></p><p>So Condition for digital root will be,</p><p></p><blockquote><p>Here n = number, b= base value (for decimal b=10)</p><p>if n==0 then digital_root(n) = 0 </p><p>if n!=0 && n%(b-1) ==0 then digital_root(n) = b-1</p><p>if n%(b-1) != 0 then digital_root(n) = n mod (b-1) </p></blockquote><p></p><p>OR</p><p>we can put this in little more simpler form,</p><p></p><blockquote><p>if n==0 then digital_root(n) = 0</p><p>else , 1 + ( (n-1)%9)</p></blockquote><p>So let's put this all in code </p><p><b><u>C++:</u></b></p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #c586c0;">#include</span><span style="color: #569cd6;"> </span><span style="color: #ce9178;"><iostream></span></div><div><span style="color: #c586c0;">using</span> <span style="color: #569cd6;">namespace</span> <span style="color: #4ec9b0;">std</span>;</div><div><span style="color: #569cd6;">int</span> <span style="color: #dcdcaa;">digital_root</span>(<span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">n</span>){</div><div> <span style="color: #c586c0;">if</span> (n==<span style="color: #b5cea8;">0</span>)<span style="color: #c586c0;">return</span> <span style="color: #b5cea8;">0</span>;</div><div> <span style="color: #c586c0;">else</span>{</div><div> <span style="color: #c586c0;">return</span> <span style="color: #b5cea8;">1</span> + ((n-<span style="color: #b5cea8;">1</span>)%<span style="color: #b5cea8;">9</span>);</div><div> }</div><div>}</div><div><span style="color: #569cd6;">int</span> <span style="color: #dcdcaa;">main</span>() {</div><div> <span style="color: #569cd6;">int</span> n;</div><div> cout << <span style="color: #ce9178;">"Enter Number: "</span>;</div><div> cin >> n;</div><div> cout <<endl;</div><div> cout << <span style="color: #ce9178;">"Digital Root Value :"</span> << <span style="color: #dcdcaa;">digital_root</span>(n);</div><div> <span style="color: #c586c0;">return</span> <span style="color: #b5cea8;">0</span>;</div><div>}<span style="background-color: transparent;"> </span></div></div><p><b><u>Python3:</u></b></p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #4ec9b0;">def</span> <span style="color: #dcdcaa;">digital_root</span>(<span style="color: #4ec9b0;">n</span>):</div><div> <span style="color: #c586c0;">if</span> n==<span style="color: #b5cea8;">0</span>:</div><div> <span style="color: #c586c0;">return</span> <span style="color: #b5cea8;">0</span></div><div> <span style="color: #c586c0;">else</span>:</div><div> <span style="color: #c586c0;">return</span> <span style="color: #b5cea8;">1</span> + ((n-<span style="color: #b5cea8;">1</span>)%<span style="color: #b5cea8;">9</span>)</div><br /><div>n = <span style="color: #569cd6;">int</span>(<span style="color: #dcdcaa;">input</span>(<span style="color: #ce9178;">"Enter Number: "</span>))</div><div><span style="color: #dcdcaa;">print</span>(<span style="color: #ce9178;">"Digital Root :"</span>,<span style="color: #dcdcaa;">digital_root</span>(n))</div></div><p><a href="https://leetcode.com/problems/add-digits/" target="_blank">LeetCode Question About Digital Root</a></p><p>If you want to know more about Digital Root --> <a href="https://en.wikipedia.org/wiki/Digital_root" target="_blank">Wikipedia</a></p><p>Thank You 😊😊</p><p></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-64585422390884025092022-02-08T01:28:00.005+05:302022-02-08T01:28:59.844+05:30Best Hacking/Programming Games Part 2<p> Here i came up with second part of this series so let's talk about some other games related to Hacking or Programming. Let's Begin<span></span></p><a name='more'></a><p></p><p>Check out Part 1 <a href="https://apnacodingadda.blogspot.com/2022/02/best-hackingprogramming-games.html" target="_blank">Here</a></p><p>6. Hacknet:</p><p>In Hacknet, you are a hacker with access to flexible code and a database filed with Waster eggs. After code a dead hacker contacts you via automated message in a ghostly inciting, you set off on a range of hack-centric missions. ---> <a href="https://en.wikipedia.org/wiki/Hacknet" target="_blank">Wikipedia</a></p><p><br /></p><p>7. CyberPunk 2077:</p><p>Since this is set in a first-person cyberpunk world. there's plenty of shenanigans to be had during combat. You can use Cyberpunk 2077's quick hacking to ping any connected device or person on a network, then upload daemons to mess with them.--> <a href="https://en.wikipedia.org/wiki/Cyberpunk_2077" target="_blank">Wikipedia</a></p><p><br /></p><p>8. HackMud:</p><p>HackMud is an MMO that casts the player as a hacker in a 90s - inspired. it's got ample tutorials. but ultimately, to this game well, you're going to need to learn some javasript. but if you, the world is you oyster. --> <a href="https://en.wikipedia.org/wiki/Hackmud" target="_blank">Wikipedia</a></p><p><br /></p><p>9. Observation:</p><p>observation is the rare game that casts the player as the computer. As SAM, a HAL-like space station OS,your goal is to help Emma, the lone (?) occupant of the station after a mysterious event leaves it powerless and stranded. --> <a href="https://en.wikipedia.org/wiki/Observation_(video_game)" target="_blank">Wikipedia</a></p><p>10. Exapunks:</p><p>Exapunks, the 2018 puzzler from zachtronics. casts you as a hacker in an alt-past 1987, even if some of its alternative history elements feel awfully at home in the present. --> <a href="https://en.wikipedia.org/wiki/Exapunks" target="_blank">Wikipedia</a></p><p><br /></p><p>Thank You 😊😊</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-44729683357375973292022-02-08T01:01:00.007+05:302022-02-08T01:03:27.889+05:30Coding Problems : Google Kick Start 2021<p> Here i am gonna cover coding problem which was asked in Google kick start competition 2021 in Round A, Let' Begin.<span></span></p><a name='more'></a><p></p><div style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: "Google Sans"; font-size: 1.25rem; font-weight: 300; letter-spacing: 0.1px; line-height: 1.75rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px; text-align: left;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgIeqBhVVboSVKRT41DMww5hhtFA1QxWMBdZYUQ5CVryL2Yew1T4AU6sx3yB-k2Wycw0U69S4c3YungI0d6btvSgql4se_277toHIPReMCSbCwNsyYyafxaSKsx4NErGlUG8iPPwRxDlUfB-bbsEBQTrgoTb-tXW17K28THqPntgFS1ILFcLZRzGh0o=s2268" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="2088" data-original-width="2268" height="295" src="https://blogger.googleusercontent.com/img/a/AVvXsEgIeqBhVVboSVKRT41DMww5hhtFA1QxWMBdZYUQ5CVryL2Yew1T4AU6sx3yB-k2Wycw0U69S4c3YungI0d6btvSgql4se_277toHIPReMCSbCwNsyYyafxaSKsx4NErGlUG8iPPwRxDlUfB-bbsEBQTrgoTb-tXW17K28THqPntgFS1ILFcLZRzGh0o=s320" width="320" /></a></div><br /><u><br /></u></div><div style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: "Google Sans"; font-size: 1.25rem; font-weight: 300; letter-spacing: 0.1px; line-height: 1.75rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px; text-align: left;"><u>Here are All Detail about problem,</u></div><h3 style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: "Google Sans"; font-size: 1.25rem; font-weight: 300; letter-spacing: 0.1px; line-height: 1.75rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;"><u>Problem</u></h3><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">Charles defines the goodness score of a string as the number of indices <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>i</mi></math>" id="MathJax-Element-1-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-1" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.401em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.344em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.31em, 1000.29em, 2.332em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.156em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-2" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-3" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Math; font-style: italic; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">i</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.162em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1px, 1px, 1px, 1px); display: inline; height: 1px; left: 0px; line-height: normal; margin: 0px; outline: 0px; overflow: hidden; padding: 0px; position: static; top: 0px; transition: none 0s ease 0s; user-select: none; vertical-align: 0px; width: 1px;"><math xmlns="http://www.w3.org/1998/Math/MathML">i</math></span></span> such that <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">S</mi></mrow><mi>i</mi></msub><mo>&#x2260;</mo><msub><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">S</mi></mrow><mrow class="MJX-TeXAtom-ORD"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">N</mi></mrow><mo>&#x2212;</mo><mi>i</mi><mo>+</mo><mn>1</mn></mrow></msub></math>" id="MathJax-Element-2-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-4" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 5.969em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 5.401em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.31em, 1005.4em, 2.616em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.213em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-5" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="msubsup" id="MathJax-Span-6" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.969em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(3.128em, 1000.57em, 4.151em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.974em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-7" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-8" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-9" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">S</span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; left: 0.628em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.804em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-10" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Math; font-size: 12.4432px; font-style: italic; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">i</span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span></span><span class="mo" id="MathJax-Span-11" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≠</span><span class="msubsup" id="MathJax-Span-12" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 3.071em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(3.128em, 1000.57em, 4.151em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.974em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-13" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-14" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-15" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">S</span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; left: 0.628em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.804em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-16" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-17" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-18" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-19" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-20" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-size: 12.4432px; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">N</span></span></span><span class="mo" id="MathJax-Span-21" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-size: 12.4432px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">−</span><span class="mi" id="MathJax-Span-22" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Math; font-size: 12.4432px; font-style: italic; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">i</span><span class="mo" id="MathJax-Span-23" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-size: 12.4432px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">+</span><span class="mn" id="MathJax-Span-24" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-size: 12.4432px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">1</span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.219em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 1.128em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.309em; width: 0px;"></span></span></nobr></span>where <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>1</mn><mo>&#x2264;</mo><mi>i</mi><mo>&#x2264;</mo><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">N</mi></mrow><mrow class="MJX-TeXAtom-ORD"><mo>/</mo></mrow><mn>2</mn></math>" id="MathJax-Element-3-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-25" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 6.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 5.457em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.366em, 1005.4em, 2.673em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-26" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-27" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">1</span><span class="mo" id="MathJax-Span-28" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="mi" id="MathJax-Span-29" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Math; font-style: italic; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">i</span><span class="mo" id="MathJax-Span-30" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="texatom" id="MathJax-Span-31" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-32" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-33" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">N</span></span></span><span class="texatom" id="MathJax-Span-34" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-35" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mo" id="MathJax-Span-36" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">/</span></span></span><span class="mn" id="MathJax-Span-37" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">2</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 1.253em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.309em; width: 0px;"></span></span></nobr></span>(<span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>1</mn></math>" id="MathJax-Element-4-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-38" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.571em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.514em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.366em, 1000.46em, 2.389em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.213em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-39" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-40" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">1</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.219em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span>-indexed). For example, the string <code style="background-repeat: no-repeat; box-sizing: inherit; font-family: monospace, monospace; margin: 0px; outline: 0px; padding: 0px;">CABABC</code> has a goodness score of <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>2</mn></math>" id="MathJax-Element-5-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-41" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.571em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.514em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.366em, 1000.46em, 2.389em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.213em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-42" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-43" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">2</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.219em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span> since <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">S</mi></mrow><mn>2</mn></msub><mo>&#x2260;</mo><msub><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">S</mi></mrow><mn>5</mn></msub></math>" id="MathJax-Element-6-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-44" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 3.866em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 3.526em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.31em, 1003.53em, 2.616em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.213em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-45" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="msubsup" id="MathJax-Span-46" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 1.082em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(3.128em, 1000.57em, 4.151em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.974em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-47" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-48" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-49" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">S</span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; left: 0.628em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.804em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-50" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-size: 12.4432px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">2</span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span></span><span class="mo" id="MathJax-Span-51" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≠</span><span class="msubsup" id="MathJax-Span-52" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 1.082em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(3.128em, 1000.57em, 4.151em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.974em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-53" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-54" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-55" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">S</span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; left: 0.628em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.804em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-56" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-size: 12.4432px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">5</span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.219em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 1.128em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.309em; width: 0px;"></span></span></nobr></span> and <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">S</mi></mrow><mn>3</mn></msub><mo>&#x2260;</mo><msub><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">S</mi></mrow><mn>4</mn></msub></math>" id="MathJax-Element-7-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-57" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 3.866em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 3.526em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.31em, 1003.53em, 2.616em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.213em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-58" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="msubsup" id="MathJax-Span-59" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 1.082em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(3.128em, 1000.57em, 4.151em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.974em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-60" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-61" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-62" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">S</span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; left: 0.628em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.804em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-63" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-size: 12.4432px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">3</span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span></span><span class="mo" id="MathJax-Span-64" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≠</span><span class="msubsup" id="MathJax-Span-65" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 1.082em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(3.128em, 1000.57em, 4.151em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.974em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-66" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-67" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-68" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">S</span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; left: 0.628em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.804em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-69" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-size: 12.4432px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">4</span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.219em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 1.128em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.309em; width: 0px;"></span></span></nobr></span>.</p><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">Charles gave Ada a string <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">S</mi></mrow></math>" id="MathJax-Element-8-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-70" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.685em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.628em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.57em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-71" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-72" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-73" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-74" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">S</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span> of length <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">N</mi></mrow></math>" id="MathJax-Element-9-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-75" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 1.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.912em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.86em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-76" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-77" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-78" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-79" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">N</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span>, consisting of uppercase letters and asked her to convert it into a string with a goodness score of <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">K</mi></mrow></math>" id="MathJax-Element-10-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-80" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 1.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.912em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.86em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-81" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-82" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-83" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-84" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">K</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span>. In one operation, Ada can change any character in the string to any uppercase letter. Could you help Ada find the <i style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;">minimum</i> number of operations required to transform the given string into a string with goodness score equal to <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">K</mi></mrow></math>" id="MathJax-Element-11-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-85" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 1.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.912em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.86em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-86" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-87" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-88" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-89" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">K</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span>?</p><h3 style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: "Google Sans"; font-size: 1.25rem; font-weight: 300; letter-spacing: 0.1px; line-height: 1.75rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;"><u>Input</u></h3><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">The first line of the input gives the number of test cases, <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">T</mi></mrow></math>" id="MathJax-Element-12-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-90" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.912em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.798em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.74em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-91" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-92" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-93" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-94" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">T</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span>. <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">T</mi></mrow></math>" id="MathJax-Element-13-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-95" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.912em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.798em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.74em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-96" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-97" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-98" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-99" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">T</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span> test cases follow.</p><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">The first line of each test case contains two integers <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">N</mi></mrow></math>" id="MathJax-Element-14-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-100" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 1.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.912em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.86em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-101" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-102" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-103" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-104" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">N</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span> and <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">K</mi></mrow></math>" id="MathJax-Element-15-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-105" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 1.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.912em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.86em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-106" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-107" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-108" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-109" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">K</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span>. The second line of each test case contains a string <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">S</mi></mrow></math>" id="MathJax-Element-16-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-110" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.685em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.628em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.57em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-111" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-112" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-113" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-114" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">S</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span> of length <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">N</mi></mrow></math>" id="MathJax-Element-17-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-115" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 1.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.912em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.86em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-116" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-117" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-118" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-119" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">N</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span>, consisting of uppercase letters.</p><h3 style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: "Google Sans"; font-size: 1.25rem; font-weight: 300; letter-spacing: 0.1px; line-height: 1.75rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;"><u>Output</u></h3><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">For each test case, output one line containing <code style="background-repeat: no-repeat; box-sizing: inherit; font-family: monospace, monospace; margin: 0px; outline: 0px; padding: 0px;">Case #<span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>" id="MathJax-Element-18-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-120" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.661em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 18.24px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.551em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.538em, 1000.5em, 2.305em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.135em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-121" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-122" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Math; font-style: italic; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">x</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.141em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.628em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span>: <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>y</mi></math>" id="MathJax-Element-19-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-123" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.606em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 18.24px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.496em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.538em, 1000.5em, 2.525em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.135em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-124" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-125" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Math; font-style: italic; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">y<span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 1px; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.003em;"></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.141em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.309em; width: 0px;"></span></span></nobr></span></code>, where <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>x</mi></math>" id="MathJax-Element-20-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-126" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.628em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.571em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.537em, 1000.51em, 2.332em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.156em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-127" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-128" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Math; font-style: italic; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">x</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.162em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.628em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span> is the test case number (starting from 1) and <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>y</mi></math>" id="MathJax-Element-21-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-129" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.571em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.514em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.537em, 1000.51em, 2.56em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.156em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-130" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-131" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Math; font-style: italic; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">y<span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 1px; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.003em;"></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.162em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.816em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.309em; width: 0px;"></span></span></nobr></span> is the minimum number of operations required to transform the given string <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">S</mi></mrow></math>" id="MathJax-Element-22-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-132" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0.685em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.628em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.57em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-133" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-134" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-135" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-136" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">S</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span> into a string with goodness score equal to <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">K</mi></mrow></math>" id="MathJax-Element-23-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-137" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 1.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 0.912em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1000.86em, 2.446em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-138" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="texatom" id="MathJax-Span-139" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-140" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-141" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">K</span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span>.</p><h3 style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: "Google Sans"; font-size: 1.25rem; font-weight: 300; letter-spacing: 0.1px; line-height: 1.75rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;"><u>Limits</u></h3><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">Memory limit: 1 GB.<br style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;" /><span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>1</mn><mo>&#x2264;</mo><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">T</mi></mrow><mo>&#x2264;</mo><mn>100</mn></math>" id="MathJax-Element-24-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-142" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 6.082em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 5.514em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1005.46em, 2.56em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-143" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-144" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">1</span><span class="mo" id="MathJax-Span-145" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="texatom" id="MathJax-Span-146" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-147" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-148" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">T</span></span></span><span class="mo" id="MathJax-Span-149" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="mn" id="MathJax-Span-150" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">100</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 1.003em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.184em; width: 0px;"></span></span></nobr></span><br style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;" /><span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>0</mn><mo>&#x2264;</mo><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">K</mi></mrow><mo>&#x2264;</mo><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">N</mi></mrow><mrow class="MJX-TeXAtom-ORD"><mo>/</mo></mrow><mn>2</mn></math>" id="MathJax-Element-25-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-151" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 6.651em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 6.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.366em, 1005.97em, 2.673em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-152" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-153" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">0</span><span class="mo" id="MathJax-Span-154" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="texatom" id="MathJax-Span-155" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-156" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-157" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">K</span></span></span><span class="mo" id="MathJax-Span-158" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="texatom" id="MathJax-Span-159" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-160" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-161" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">N</span></span></span><span class="texatom" id="MathJax-Span-162" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-163" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mo" id="MathJax-Span-164" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">/</span></span></span><span class="mn" id="MathJax-Span-165" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">2</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 1.253em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.309em; width: 0px;"></span></span></nobr></span>.<br style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;" /></p><h4 style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: "Google Sans"; font-size: 1.25rem; font-weight: 300; letter-spacing: 0.1px; line-height: 1.75rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;"><u>Test Set 1</u></h4><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">Time limit: 20 seconds.<br style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;" /><span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>1</mn><mo>&#x2264;</mo><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">N</mi></mrow><mo>&#x2264;</mo><mn>100</mn></math>" id="MathJax-Element-26-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-166" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 6.139em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 5.571em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1005.51em, 2.56em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-167" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-168" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">1</span><span class="mo" id="MathJax-Span-169" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="texatom" id="MathJax-Span-170" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-171" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-172" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">N</span></span></span><span class="mo" id="MathJax-Span-173" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="mn" id="MathJax-Span-174" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">100</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 1.066em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.184em; width: 0px;"></span></span></nobr></span>.<br style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;" /></p><h4 style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: "Google Sans"; font-size: 1.25rem; font-weight: 300; letter-spacing: 0.1px; line-height: 1.75rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;"><u>Test Set 2</u></h4><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">Time limit: 40 seconds.<br style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;" /><span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>1</mn><mo>&#x2264;</mo><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">N</mi></mrow><mo>&#x2264;</mo><mn>2</mn><mo>&#x00D7;</mo><msup><mn>10</mn><mn>5</mn></msup></math>" id="MathJax-Element-27-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-175" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 8.014em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 7.276em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.253em, 1007.28em, 2.56em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-176" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-177" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">1</span><span class="mo" id="MathJax-Span-178" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="texatom" id="MathJax-Span-179" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-180" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-181" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">N</span></span></span><span class="mo" id="MathJax-Span-182" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="mn" id="MathJax-Span-183" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">2</span><span class="mo" id="MathJax-Span-184" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.23em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">×</span><span class="msubsup" id="MathJax-Span-185" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.23em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 1.423em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(3.128em, 1000.97em, 4.151em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -3.974em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-186" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">10</span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; left: 1.026em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -4.372em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-187" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-size: 12.4432px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">5</span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 3.98em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span></span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 1.253em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.184em; width: 0px;"></span></span></nobr></span> for at most <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>10</mn></math>" id="MathJax-Element-28-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-188" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 1.139em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 1.026em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.366em, 1000.97em, 2.389em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.213em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-189" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-190" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">10</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.219em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 0.878em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.059em; width: 0px;"></span></span></nobr></span> test cases.<br style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;" />For the remaining cases, <span class="MathJax_Preview" color="inherit" style="background-repeat: no-repeat; box-sizing: inherit; margin: 0px; outline: 0px; padding: 0px;"></span><span class="MathJax" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>1</mn><mo>&#x2264;</mo><mrow class="MJX-TeXAtom-ORD"><mi mathvariant="bold">N</mi></mrow><mo>&#x2264;</mo><mn>100</mn></math>" id="MathJax-Element-29-Frame" role="presentation" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; direction: ltr; display: inline-table; float: none; letter-spacing: normal; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px; overflow-wrap: normal; padding: 0px; position: relative; white-space: nowrap; word-spacing: normal;" tabindex="0"><nobr aria-hidden="true" style="background-repeat: no-repeat; border: 0px; box-sizing: inherit; line-height: normal; margin: 0px; max-height: none; max-width: none; min-height: 0px; min-width: 0px; outline: 0px !important; padding: 0px; transition: none 0s ease 0s; vertical-align: 0px;"><span class="math" id="MathJax-Span-191" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 6.139em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; font-size: 17.6px; height: 0px; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: relative; transition: none 0s ease 0s; vertical-align: 0px; width: 5.571em;"><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; clip: rect(1.423em, 1005.51em, 2.56em, -999.997em); left: 0em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: absolute; top: -2.27em; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-192" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mn" id="MathJax-Span-193" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">1</span><span class="mo" id="MathJax-Span-194" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="texatom" id="MathJax-Span-195" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mrow" id="MathJax-Span-196" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;"><span class="mi" id="MathJax-Span-197" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; font-weight: bold; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px;">N</span></span></span><span class="mo" id="MathJax-Span-198" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">≤</span><span class="mn" id="MathJax-Span-199" style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline; font-family: MathJax_Main; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px 0px 0px 0.287em; position: static; transition: none 0s ease 0s; vertical-align: 0px;">100</span></span><span style="background-repeat: no-repeat; border: 0px; box-sizing: content-box; display: inline-block; height: 2.276em; line-height: normal; margin: 0px; outline: 0px !important; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: 0px; width: 0px;"></span></span></span><span style="background-repeat: no-repeat; border-bottom-style: initial; border-color: initial; border-image: initial; border-left-style: solid; border-right-style: initial; border-top-style: initial; border-width: 0px; box-sizing: content-box; display: inline-block; height: 1.066em; line-height: normal; margin: 0px; outline: 0px !important; overflow: hidden; padding: 0px; position: static; transition: none 0s ease 0s; vertical-align: -0.184em; width: 0px;"></span></span></nobr></span>.</p><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">Let's Code then,</p><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">C++:</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #c586c0;">#include</span><span style="color: #ce9178;"><iostream></span></div><div><span style="color: #c586c0;">#include</span><span style="color: #ce9178;"><string></span></div><div><span style="color: #c586c0;">#include</span><span style="color: #ce9178;"><cstdlib></span></div><div><span style="color: #c586c0;">using</span> <span style="color: #569cd6;">namespace</span> <span style="color: #4ec9b0;">std</span>;</div><div><span style="color: #569cd6;">int</span> <span style="color: #dcdcaa;">kgoodnessstring</span>(<span style="color: #4ec9b0;">string</span> <span style="color: #9cdcfe;">s</span>,<span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">k</span>){</div><div> <span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">count</span> = <span style="color: #b5cea8;">0</span>;</div><div> <span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">n</span> = <span style="color: #9cdcfe;">s</span>.<span style="color: #dcdcaa;">size</span>();</div><div> <span style="color: #c586c0;">for</span>(<span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">i</span>=<span style="color: #b5cea8;">0</span>;<span style="color: #9cdcfe;">i</span><<span style="color: #9cdcfe;">n</span>/<span style="color: #b5cea8;">2</span>;<span style="color: #9cdcfe;">i</span>++){</div><div> <span style="color: #c586c0;">if</span>(<span style="color: #9cdcfe;">s</span><span style="color: #dcdcaa;">[</span><span style="color: #9cdcfe;">i</span><span style="color: #dcdcaa;">]</span>!=<span style="color: #9cdcfe;">s</span><span style="color: #dcdcaa;">[</span><span style="color: #9cdcfe;">n</span>-<span style="color: #9cdcfe;">i</span>-<span style="color: #b5cea8;">1</span><span style="color: #dcdcaa;">]</span>){</div><div> <span style="color: #9cdcfe;">count</span>++;</div><div> }</div><div> }</div><div> <span style="color: #c586c0;">return</span> <span style="color: #dcdcaa;">abs</span>(<span style="color: #9cdcfe;">count</span>-<span style="color: #9cdcfe;">k</span>);</div><div>}</div><div><span style="color: #569cd6;">int</span> <span style="color: #dcdcaa;">main</span>(){</div><div> <span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">t</span>;</div><div> <span style="color: #9cdcfe;">cin</span> <span style="color: #dcdcaa;">>></span> <span style="color: #9cdcfe;">t</span>;</div><div> <span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">n</span>,<span style="color: #9cdcfe;">k</span>;</div><div> <span style="color: #c586c0;">for</span>(<span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">i</span>=<span style="color: #b5cea8;">0</span>;<span style="color: #9cdcfe;">i</span><<span style="color: #9cdcfe;">t</span>;<span style="color: #9cdcfe;">i</span>++){</div><div> <span style="color: #9cdcfe;">cin</span> <span style="color: #dcdcaa;">>></span><span style="color: #9cdcfe;">n</span><span style="color: #dcdcaa;">>></span><span style="color: #9cdcfe;">k</span>;</div><div> <span style="color: #4ec9b0;">string</span> <span style="color: #9cdcfe;">s</span>;</div><div> <span style="color: #9cdcfe;">cin</span> <span style="color: #dcdcaa;">>></span> <span style="color: #9cdcfe;">s</span>;</div><div> <span style="color: #9cdcfe;">cout</span> <span style="color: #dcdcaa;"><<</span> <span style="color: #ce9178;">"Case #"</span><span style="color: #dcdcaa;"><<</span><span style="color: #9cdcfe;">i</span>+<span style="color: #b5cea8;">1</span><span style="color: #dcdcaa;"><<</span><span style="color: #ce9178;">": "</span><span style="color: #dcdcaa;"><<</span><span style="color: #dcdcaa;">kgoodnessstring</span>(<span style="color: #9cdcfe;">s</span>,<span style="color: #9cdcfe;">k</span>)<span style="color: #dcdcaa;"><<</span><span style="color: #ce9178;">"</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">"</span>;</div><div> }</div><div> </div><div>}</div><br /></div><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">Python3:</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #569cd6;">def</span> <span style="color: #dcdcaa;">kgoodnessString</span>(<span style="color: #9cdcfe;">s</span>,<span style="color: #9cdcfe;">k</span>):</div><div> <span style="color: #9cdcfe;">count</span> = <span style="color: #b5cea8;">0</span></div><div> <span style="color: #9cdcfe;">n</span> = <span style="color: #dcdcaa;">len</span>(<span style="color: #9cdcfe;">s</span>)</div><div> <span style="color: #c586c0;">for</span> <span style="color: #9cdcfe;">i</span> <span style="color: #c586c0;">in</span> <span style="color: #4ec9b0;">range</span>(<span style="color: #9cdcfe;">n</span>//<span style="color: #b5cea8;">2</span>):</div><div> <span style="color: #c586c0;">if</span> <span style="color: #9cdcfe;">s</span>[<span style="color: #9cdcfe;">i</span>] != <span style="color: #9cdcfe;">s</span>[<span style="color: #9cdcfe;">n</span>-<span style="color: #9cdcfe;">i</span>-<span style="color: #b5cea8;">1</span>]:</div><div> <span style="color: #9cdcfe;">count</span>+=<span style="color: #b5cea8;">1</span></div><div> <span style="color: #c586c0;">return</span> <span style="color: #dcdcaa;">abs</span>(<span style="color: #9cdcfe;">count</span>-<span style="color: #9cdcfe;">k</span>)</div><br /><div><span style="color: #9cdcfe;">t</span> = <span style="color: #4ec9b0;">int</span>(<span style="color: #dcdcaa;">input</span>())</div><div><span style="color: #c586c0;">for</span> <span style="color: #9cdcfe;">i</span> <span style="color: #c586c0;">in</span> <span style="color: #4ec9b0;">range</span>(<span style="color: #9cdcfe;">t</span>):</div><div> <span style="color: #9cdcfe;">n</span>,<span style="color: #9cdcfe;">k</span> = <span style="color: #dcdcaa;">input</span>().<span style="color: #dcdcaa;">split</span>()</div><div> <span style="color: #9cdcfe;">n</span> = <span style="color: #4ec9b0;">int</span>(<span style="color: #9cdcfe;">n</span>)</div><div> <span style="color: #9cdcfe;">k</span> = <span style="color: #4ec9b0;">int</span>(<span style="color: #9cdcfe;">k</span>)</div><div> <span style="color: #9cdcfe;">s</span> = <span style="color: #dcdcaa;">input</span>()</div><div> <span style="color: #9cdcfe;">ans</span> = <span style="color: #dcdcaa;">kgoodnessString</span>(<span style="color: #9cdcfe;">s</span>,<span style="color: #9cdcfe;">k</span>)</div><div> <span style="color: #dcdcaa;">print</span>(<span style="color: #569cd6;">f</span><span style="color: #ce9178;">"Case #</span><span style="color: #569cd6;">{</span><span style="color: #9cdcfe;">i</span>+<span style="color: #b5cea8;">1</span><span style="color: #569cd6;">}</span><span style="color: #ce9178;">: </span><span style="color: #569cd6;">{</span><span style="color: #9cdcfe;">ans</span><span style="color: #569cd6;">}</span><span style="color: #ce9178;">"</span>)</div></div><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;"><br /></p><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;">Thank You 😊😊</p><p style="-webkit-font-smoothing: antialiased; background-repeat: no-repeat; box-sizing: inherit; color: #202124; font-family: Roboto; font-size: 16px; letter-spacing: 0.1px; line-height: 1.5rem; margin: 1rem 0px 0px; outline: 0px; padding: 0px;"><br /></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-13743969574770201252022-02-07T02:25:00.005+05:302022-02-19T16:53:01.729+05:30I created website which generates Random Quotes of anime<!--Google Tag Manager-->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-NVWZCCB');</script>
<!--End Google Tag Manager-->
<p> Hello Everyone , Today's post is all about how i created website which generates random anime Quotes. Then Let's begin...<span></span></p><a name='more'></a><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjGuuSL9i5KAyQJjhSpEALk8aegy-mAQuB5r8QYZ3vFrOG8eHk1GdZ7Xtrf5VfKoH2gB5KKqXsuz5coGmHHvD91GgSMC0IHQOPbNOothZ5N2pa31IRDY8oN9SuXFOKxt3QHgBwPRv_DTFeg72Eu0V6yRBisighBWB-j4lfM7YvC5tEJM7P0yYfBST1g=s860" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="743" data-original-width="860" height="276" src="https://blogger.googleusercontent.com/img/a/AVvXsEjGuuSL9i5KAyQJjhSpEALk8aegy-mAQuB5r8QYZ3vFrOG8eHk1GdZ7Xtrf5VfKoH2gB5KKqXsuz5coGmHHvD91GgSMC0IHQOPbNOothZ5N2pa31IRDY8oN9SuXFOKxt3QHgBwPRv_DTFeg72Eu0V6yRBisighBWB-j4lfM7YvC5tEJM7P0yYfBST1g=s320" width="320" /></a></div><p>This website is simple. it uses API random quotes generator . so i will just put code here which i use to create that website.</p><p>You just need basic knowledge of HTML, CSS and JavaScript.</p><p>Please Check Last Message on this page.</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div style="line-height: 19px;"><div><span style="color: grey;"><!</span><span style="color: #569cd6;">DOCTYPE</span> <span style="color: #9cdcfe;">html</span><span style="color: grey;">></span></div><div><span style="color: grey;"><</span><span style="color: #569cd6;">html</span> <span style="color: #9cdcfe;">lang</span>=<span style="color: #ce9178;">"en"</span><span style="color: grey;">></span></div><div><span style="color: grey;"><</span><span style="color: #569cd6;">head</span><span style="color: grey;">></span></div><div> <span style="color: grey;"><</span><span style="color: #569cd6;">meta</span> <span style="color: #9cdcfe;">charset</span>=<span style="color: #ce9178;">"UTF-8"</span><span style="color: grey;">></span></div><div> <span style="color: grey;"><</span><span style="color: #569cd6;">meta</span> <span style="color: #9cdcfe;">http-equiv</span>=<span style="color: #ce9178;">"X-UA-Compatible"</span> <span style="color: #9cdcfe;">content</span>=<span style="color: #ce9178;">"IE=edge"</span><span style="color: grey;">></span></div><div> <span style="color: grey;"><</span><span style="color: #569cd6;">meta</span> <span style="color: #9cdcfe;">name</span>=<span style="color: #ce9178;">"viewport"</span> <span style="color: #9cdcfe;">content</span>=<span style="color: #ce9178;">"width=device-width, initial-scale=1.0"</span><span style="color: grey;">></span></div><div> <span style="color: grey;"><</span><span style="color: #569cd6;">title</span><span style="color: grey;">></span>Anime Quotes<span style="color: grey;"></</span><span style="color: #569cd6;">title</span><span style="color: grey;">></span></div><div><span style="color: grey;"></</span><span style="color: #569cd6;">head</span><span style="color: grey;">></span></div><div><span style="color: grey;"><</span><span style="color: #569cd6;">style</span><span style="color: grey;">></span></div><div> <span style="color: #569cd6;">*</span>{</div><div> <span style="color: #9cdcfe;">margin</span>: <span style="color: #b5cea8;">0</span>;</div><div> <span style="color: #9cdcfe;">padding</span>: <span style="color: #b5cea8;">0</span>;</div><div> <span style="color: #9cdcfe;">box-sizing</span>: <span style="color: #ce9178;">border-box</span>;</div><div> <span style="color: #9cdcfe;">background-color</span>: <span style="color: #ce9178;">black</span>;</div><div> <span style="color: #9cdcfe;">color</span>: <span style="color: #ce9178;">white</span>;</div><div> }</div><div> <span style="color: #d7ba7d;">.main-box</span>{</div><br /><div> <span style="color: #9cdcfe;">border-radius</span>: <span style="color: #b5cea8;">15px</span>;</div><div> <span style="color: #9cdcfe;">background-color</span>: <span style="color: #ce9178;">wheat</span>;</div><div> <span style="color: #9cdcfe;">position</span>: <span style="color: #ce9178;">absolute</span>;</div><div> <span style="color: #9cdcfe;">left</span>: <span style="color: #b5cea8;">50%</span>;</div><div> <span style="color: #9cdcfe;">top</span>: <span style="color: #b5cea8;">50%</span>;</div><div> <span style="color: #9cdcfe;">transform</span>: <span style="color: #dcdcaa;">translate</span>(<span style="color: #b5cea8;">-50%</span>,<span style="color: #b5cea8;">-50%</span>);</div><div> <span style="color: #9cdcfe;">padding</span>: <span style="color: #b5cea8;">10px</span>;</div><div> }</div><div> <span style="color: #d7ba7d;">.anime</span>{</div><div> <span style="color: #9cdcfe;">text-align</span>: <span style="color: #ce9178;">center</span>;</div><div> <span style="color: #9cdcfe;">color</span>: <span style="color: #dcdcaa;">rgb</span>(<span style="color: #b5cea8;">255</span>, <span style="color: #b5cea8;">144</span>, <span style="color: #b5cea8;">144</span>);</div><div> <span style="color: #9cdcfe;">text-decoration</span>: <span style="color: #ce9178;">underline</span>;</div><div> <span style="color: #9cdcfe;">font-family</span>:-apple-system, BlinkMacSystemFont,</div><div> <span style="color: #ce9178;">'Segoe UI'</span>, Roboto, Oxygen, Ubuntu, Cantarell,</div><div> <span style="color: #ce9178;">'Open Sans'</span>, <span style="color: #ce9178;">'Helvetica Neue'</span>, <span style="color: #ce9178;">sans-serif</span>;</div><br /><div> }</div><div> <span style="color: #d7ba7d;">.data</span>{</div><div> <span style="color: #9cdcfe;">padding</span>: <span style="color: #b5cea8;">10px</span>;</div><div> <span style="color: #9cdcfe;">font-family</span>: <span style="color: #ce9178;">'Courier New'</span>, <span style="color: #ce9178;">Courier</span>, <span style="color: #ce9178;">monospace</span>;</div><div> <span style="color: #9cdcfe;">background-color</span>: <span style="color: #dcdcaa;">rgb</span>(<span style="color: #b5cea8;">47</span>, <span style="color: #b5cea8;">56</span>, <span style="color: #b5cea8;">56</span>);</div><div> }</div><div> <span style="color: #d7ba7d;">.box</span>{</div><div> <span style="color: #9cdcfe;">background-color</span>: <span style="color: #ce9178;">honeydew</span>;</div><div> <span style="color: #9cdcfe;">border-radius</span>: <span style="color: #b5cea8;">15px</span>;</div><div> </div><div> }</div><div><span style="color: grey;"></</span><span style="color: #569cd6;">style</span><span style="color: grey;">></span></div><div><span style="color: grey;"><</span><span style="color: #569cd6;">body<!--Google Tag Manager (noscript)-->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NVWZCCB"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!--End Google Tag Manager (noscript)--></span><span style="color: grey;">></span></div><div> <span style="color: grey;"><</span><span style="color: #569cd6;">div</span> <span style="color: #9cdcfe;">class</span>=<span style="color: #ce9178;">"main-box"</span><span style="color: grey;">></span></div><div> <span style="color: grey;"><</span><span style="color: #569cd6;">div</span> <span style="color: #9cdcfe;">class</span>=<span style="color: #ce9178;">"box"</span><span style="color: grey;">></span></div><br /><div> <span style="color: grey;"><</span><span style="color: #569cd6;">h2</span> <span style="color: #9cdcfe;">class</span>=<span style="color: #ce9178;">"anime"</span><span style="color: grey;">></</span><span style="color: #569cd6;">h2</span><span style="color: grey;">></span></div><div> <span style="color: grey;"><</span><span style="color: #569cd6;">h3</span> <span style="color: #9cdcfe;">class</span>=<span style="color: #ce9178;">"data"</span><span style="color: grey;">></</span><span style="color: #569cd6;">h3</span><span style="color: grey;">></span></div><div> <span style="color: grey;"></</span><span style="color: #569cd6;">div</span><span style="color: grey;">></span></div><div> <span style="color: grey;"></</span><span style="color: #569cd6;">div</span><span style="color: grey;">></span></div><div> <span style="color: grey;"><</span><span style="color: #569cd6;">script</span><span style="color: grey;">></span></div><div> <span style="color: #569cd6;">const</span> <span style="color: #4fc1ff;">api</span> = <span style="color: #ce9178;">"https://animechan.vercel.app/api/random"</span>;</div><div> <span style="color: #569cd6;">async</span> <span style="color: #569cd6;">function</span> <span style="color: #dcdcaa;">getquote</span>(){</div><div> <span style="color: #569cd6;">const</span> <span style="color: #4fc1ff;">response</span> = <span style="color: #c586c0;">await</span> <span style="color: #dcdcaa;">fetch</span>(<span style="color: #4fc1ff;">api</span>);</div><div> <span style="color: #569cd6;">const</span> <span style="color: #4fc1ff;">data</span> = <span style="color: #c586c0;">await</span> <span style="color: #4fc1ff;">response</span>.<span style="color: #dcdcaa;">json</span>();</div><div> <span style="color: #9cdcfe;">console</span>.<span style="color: #dcdcaa;">log</span>(<span style="color: #4fc1ff;">data</span>)</div><div> <span style="color: #569cd6;">const</span> <span style="color: #4fc1ff;">anime</span> = <span style="color: #4fc1ff;">data</span>[<span style="color: #ce9178;">'anime'</span>];</div><div> <span style="color: #569cd6;">const</span> <span style="color: #4fc1ff;">character</span> = <span style="color: #4fc1ff;">data</span>[<span style="color: #ce9178;">'character'</span>];</div><div> <span style="color: #569cd6;">const</span> <span style="color: #4fc1ff;">quote</span> = <span style="color: #4fc1ff;">data</span>[<span style="color: #ce9178;">'quote'</span>];</div><div> <span style="color: #9cdcfe;">console</span>.<span style="color: #dcdcaa;">log</span>(<span style="color: #4fc1ff;">anime</span>,<span style="color: #4fc1ff;">character</span>,<span style="color: #4fc1ff;">quote</span>);</div><div> <span style="color: #569cd6;">const</span> <span style="color: #4fc1ff;">otherdata</span> = <span style="color: #4fc1ff;">character</span>+ <span style="color: #ce9178;">" Once Said "</span> + <span style="color: #4fc1ff;">quote</span>;</div><div> <span style="color: #9cdcfe;">console</span>.<span style="color: #dcdcaa;">log</span>(<span style="color: #4fc1ff;">otherdata</span>)</div><div> <span style="color: #9cdcfe;">document</span>.<span style="color: #dcdcaa;">getElementsByClassName</span>(<span style="color: #ce9178;">"anime"</span>)[<span style="color: #b5cea8;">0</span>].<span style="color: #9cdcfe;">textContent</span> = <span style="color: #4fc1ff;">anime</span>;</div><div> <span style="color: #9cdcfe;">document</span>.<span style="color: #dcdcaa;">getElementsByClassName</span>(<span style="color: #ce9178;">"data"</span>)[<span style="color: #b5cea8;">0</span>].<span style="color: #9cdcfe;">textContent</span> = <span style="color: #4fc1ff;">otherdata</span>;</div><br /><div> }</div><div> <span style="color: #dcdcaa;">getquote</span>();</div><div> <span style="color: grey;"></</span><span style="color: #569cd6;">script</span><span style="color: grey;">></span></div><div><span style="color: grey;"></</span><span style="color: #569cd6;">body</span><span style="color: grey;">></span></div><div><span style="color: grey;"></</span><span style="color: #569cd6;">html</span><span style="color: grey;">></span></div></div></div><p>if you want to host your website on GitHub then follow some steps which are <a href="https://pages.github.com/" target="_blank">Here</a></p><p>[****IMPORTANT****]</p><p>I've also made this website using python framework Django and deploy it on Heroku. so if you want tutorial for making website using Django and deploy it on Heroku than comment down. I will put as fast as i can.</p><p>By the way i 've already created that website you can check it out <a href="https://animequetesgenerator.herokuapp.com/" target="_blank">Here</a></p><p>Comment Below if you want Full step by step guide for Creating This website using Django and Deploy on Heroku.</p><p>Thank You 😊😊</p><p><br /></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-74828066697080028562022-02-04T01:19:00.006+05:302022-02-04T02:02:29.429+05:30Instagram OSINT<p> OSINT stands for <b>Open Source INTelligence</b>. it means any information that can legally gathered from free , open source software or tool. if you want simple Example of OSINT then any search engine is OSINT. Today's Topic is Instagram OSINT then let's get started......<span></span></p><a name='more'></a><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjjphc3ePyqQhz77dcd0Qnx2aNC-ZXofG8Hs6Dnbf4-QDihPUUs-5rpbvE1CgpnIbQfEhoqnh-dswyL30zKHr_HBBgVxa452F1Ju3st67JIWaAAJ1sBYCm4-Sj-eedwfJHAsRlPTSrecH7F9TA0XBImg-PDbvYj6Xgf9JvBjKZtoGR45-KQ6BdWnVoV=s310" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="163" data-original-width="310" height="227" src="https://blogger.googleusercontent.com/img/a/AVvXsEjjphc3ePyqQhz77dcd0Qnx2aNC-ZXofG8Hs6Dnbf4-QDihPUUs-5rpbvE1CgpnIbQfEhoqnh-dswyL30zKHr_HBBgVxa452F1Ju3st67JIWaAAJ1sBYCm4-Sj-eedwfJHAsRlPTSrecH7F9TA0XBImg-PDbvYj6Xgf9JvBjKZtoGR45-KQ6BdWnVoV=w374-h227" width="374" /></a></div><div><br /></div><div><br /></div><div><br /></div><div>There is Tool for Instagram OSINT named Osintgram. So You can download that tool with below line(For Linux)</div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;">git clone <span style="color: #9cdcfe;">https</span>://github.com/Datalux/Osintgram</div></div><div><br /></div><div>Now change directory,</div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;">cd Osintgram/</div></div><div><br /></div><div>Download requirements</div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;">pip install -m requirements.txt</div></div><div><br /></div><div>Now you need to give your instagram account credentials for login to instagram (Also you can create F@ke account) so goto config/ and add those details as below</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiBYu-58_ncdQcnSTN75D9417V4kctlzkrDaBZ-H60hvi0e6EVq23nHMMWokXQFCLuw4t4BMgmCAR6WC-nFIaTtcQ9FrMvLeQOBvXOO1hZO_kRxdzr3Dv9UGKm3f4oohCRq29rIFBEjI-HfczhjR88D71-k03pW7zfnWjS8FtX5ZtbO37v7ozNZk1Pq=s1049" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="620" data-original-width="1049" height="360" src="https://blogger.googleusercontent.com/img/a/AVvXsEiBYu-58_ncdQcnSTN75D9417V4kctlzkrDaBZ-H60hvi0e6EVq23nHMMWokXQFCLuw4t4BMgmCAR6WC-nFIaTtcQ9FrMvLeQOBvXOO1hZO_kRxdzr3Dv9UGKm3f4oohCRq29rIFBEjI-HfczhjR88D71-k03pW7zfnWjS8FtX5ZtbO37v7ozNZk1Pq=w589-h360" width="589" /></a></div><div><br /></div><div>Now we're ready to do OSINT;</div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;">python3 main.py <target name></div></div><div><br /></div><div>write username of person you want to know details</div><div>Below photo shows list of operation you can perform or just type <b>list</b> after running main.py</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhj7CAZAIeQak2CJJYAA313rmNM_T2Do5g6ueLTDgPEK7kfmF2mxwfhhKUtSdX6VCCUL55c8q9mxHMBf5pHmYlIxi_YnQmMwXEfdISzLwuZe35Ze4WcWG7aVD-qKQACHr5nRbdtj4k8w8yNUKfSUt2aTWEOfGDzupnGkh9O0PtAp5Mcot6LHafkceAb=s962" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="662" data-original-width="962" height="412" src="https://blogger.googleusercontent.com/img/a/AVvXsEhj7CAZAIeQak2CJJYAA313rmNM_T2Do5g6ueLTDgPEK7kfmF2mxwfhhKUtSdX6VCCUL55c8q9mxHMBf5pHmYlIxi_YnQmMwXEfdISzLwuZe35Ze4WcWG7aVD-qKQACHr5nRbdtj4k8w8yNUKfSUt2aTWEOfGDzupnGkh9O0PtAp5Mcot6LHafkceAb=w600-h412" width="600" /></a></div>You can download all images uploaded by Target, you can get list of captions used by Target, you can get list of hashtags used by user and lots of other things. Just Explore it<div><br /></div><div>Thank You 😊😊</div><div><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody><tr><td style="text-align: center;"><span style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><a href="https://www.linkedin.com/in/arth-prajapati-835325214/" target="_blank"><img border="0" data-original-height="707" data-original-width="800" height="40" src="https://blogger.googleusercontent.com/img/a/AVvXsEgJxnlX5ms_Vkqomruy6SdzYt6KSmv9zMgowXlz4un5y2z2P0JpqeWSLcGK6w0LT7iNbSHfGb5k2QpkZ5XuzoerlD7R7lHdyjBQCoFsHod3Co1F0ZncO3KLBH6DWrmLRjZNDu7-al1_NJ8r7Kerr4t51eryfQ_JnXI2jqH__2PfUChxF-zw6Ws38xP3=w39-h40" width="39" /></a></span></td></tr><tr><td class="tr-caption" style="text-align: center;"><a href="https://www.linkedin.com/in/arth-prajapati-835325214/" target="_blank"><br /></a></td></tr></tbody></table></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-17982937644316816002022-02-03T01:44:00.002+05:302022-02-03T01:44:25.238+05:30Best Hacking/Programming Games<p> Hey Everyone , so in today's post i'm gonna cover few games which can improve your programming logic and it's fun to play for programmers/hackers. then let's get started..<span></span></p><a name='more'></a><p></p><p><br /></p><p>1. UPLINK:</p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><p>In this game you'll perform various kind of operations like hacking severs and stealing money etc. also you get hired to do this type of work and you use various software to perform this activities. for more detail about game --> <a href="https://en.wikipedia.org/wiki/Uplink_(video_game)" target="_blank">Wikipedia</a></p></blockquote><p>2. SYSTEM SHOCK 2:</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;">Basically, You play a simplified game of Minesweeper where you're requited to link three mines in a row for a successful hack. ---> <a href="https://en.wikipedia.org/wiki/System_Shock_2" target="_blank">Wikipedia</a></p></blockquote><p>3. DEUS EX: HUMAN REVOLUTION:</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;">The interface is similarly interesting, with players capturing nodes on a grid to build a path between two points. The system returned. mostly unchanged.in the 2016 sequel mankind divided. --> <a href="https://en.wikipedia.org/wiki/Deus_Ex:_Human_Revolution" target="_blank">Wikipedia</a></p></blockquote><p>4. WATCH DOGS LEGION:</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;">This game is giving you control of a potential city's worth of rapscallions and scoundrels opens up new infiltration possibilities, no matter what the job is. --> <a href="https://en.wikipedia.org/wiki/Watch_Dogs:_Legion" target="_blank">Wikipedia</a></p></blockquote><p>5. QUADRILATERAL COWBOY:</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;">Like watch dogs legion, Quadrilateral cowboy is a game about is using hacking to get in, Grab the thing . and get out without anyone realising you were ever there. --> <a href="https://en.wikipedia.org/wiki/Quadrilateral_Cowboy" target="_blank">Wikipedia</a></p></blockquote><p><br /></p><p>Want Second Part of this Post then comment below</p><p>Thank You 😊😊</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-60783174447508863732022-02-03T01:11:00.005+05:302022-02-03T01:13:39.937+05:30Fake Information Generator using Python<p> Hey Everyone , Today i'm gonna cover the topic fake information generator using python . and we'll see how to generate fake name , number and whole identity of fake human. Then let's get started ...<span></span></p><a name='more'></a><p></p><p><br /></p><p>Python has library named Faker which help us to generate fake information, use pip or pip3 to install it</p><blockquote data-darkreader-inline-border-bottom="" data-darkreader-inline-border-left="" data-darkreader-inline-border-right="" data-darkreader-inline-border-top="" style="--darkreader-inline-border-bottom: initial; --darkreader-inline-border-left: initial; --darkreader-inline-border-right: initial; --darkreader-inline-border-top: initial; border: none; margin: 0px 0px 0px 40px; padding: 0px;"><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; text-align: left; white-space: pre;">pip install <span data-darkreader-inline-color="" style="--darkreader-inline-color: #5ccdb6; color: #4ec9b0;">Faker</span></div></blockquote><p>Now create fakeInfo.py file open it and write code:</p><p><br /></p><blockquote data-darkreader-inline-border-bottom="" data-darkreader-inline-border-left="" data-darkreader-inline-border-right="" data-darkreader-inline-border-top="" style="--darkreader-inline-border-bottom: initial; --darkreader-inline-border-left: initial; --darkreader-inline-border-right: initial; --darkreader-inline-border-top: initial; border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #c688c1; color: #c586c0;">from</span> <span data-darkreader-inline-color="" style="--darkreader-inline-color: #5ccdb6; color: #4ec9b0;">faker</span> <span data-darkreader-inline-color="" style="--darkreader-inline-color: #c688c1; color: #c586c0;">import</span> <span data-darkreader-inline-color="" style="--darkreader-inline-color: #5ccdb6; color: #4ec9b0;">Faker</span></div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span> = <span data-darkreader-inline-color="" style="--darkreader-inline-color: #5ccdb6; color: #4ec9b0;">Faker</span>()</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake Name:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.name())</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake DOB:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.date_of_birth())</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake Contry:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.country())</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake Password:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.password())</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake Address:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.address())</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake zipcode:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.zipcode())</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake Email:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.ascii_safe_email())</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake Credit Card Details:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.credit_card_full())</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake IPv4:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.ipv4())</div></div><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"Fake CryptoCurrency Name:"</span>,<span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">fake</span>.cryptocurrency_name())</div></div></blockquote><p><br /></p><p>Output:</p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px; text-align: left;"><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake <span style="color: #9cdcfe;">Name</span>: Jason Rivera</div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake <span style="color: #4fc1ff;">DOB</span>: <span style="color: #b5cea8;">2008</span>-<span style="color: #b5cea8;">11</span>-<span style="color: #b5cea8;">22</span></div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake <span style="color: #9cdcfe;">Contry</span>: Reunion</div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake <span style="color: #9cdcfe;">Password</span>: jib35Wqno@</div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake <span style="color: #9cdcfe;">Address</span>: <span style="color: #b5cea8;">812</span> Estrada Fields Suite <span style="color: #b5cea8;">299</span></div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div> Tylerstad, VA <span style="color: #b5cea8;">88019</span></div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake <span style="color: #9cdcfe;">zipcode</span>: <span style="color: #b5cea8;">67747</span></div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake <span style="color: #9cdcfe;">Email</span>: crystalchapman@example.com</div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake Credit Card <span style="color: #9cdcfe;">Details</span>: VISA <span style="color: #b5cea8;">13</span> digit</div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div> Donald Logan</div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div> <span style="color: #b5cea8;">4432345007406</span> <span style="color: #b5cea8;">0</span><span style="color: #f44747;">6</span>/<span style="color: #b5cea8;">24</span></div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div> <span style="color: #4fc1ff;">CVC</span>: <span style="color: #b5cea8;">284</span></div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake <span style="color: #9cdcfe;">IPv4</span>: <span style="color: #b5cea8;">217.211</span>.203.113</div></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div>Fake CryptoCurrency <span style="color: #9cdcfe;">Name</span>: Bytecoin</div></div></blockquote><p><br /></p><p>So this how you can generate fake info..</p><p>If you want to know more types of fake information then ,</p><blockquote data-darkreader-inline-border-bottom="" data-darkreader-inline-border-left="" data-darkreader-inline-border-right="" data-darkreader-inline-border-top="" style="--darkreader-inline-border-bottom: initial; --darkreader-inline-border-left: initial; --darkreader-inline-border-right: initial; --darkreader-inline-border-top: initial; border: none; margin: 0px 0px 0px 40px; padding: 0px;"><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div style="text-align: left;"><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">dir</span>(<span data-darkreader-inline-color="" style="--darkreader-inline-color: #5ccdb6; color: #4ec9b0;">Faker</span>()))</div></div></blockquote><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div></div></div><p><br /></p><p>Let me know your thoughts in comment box</p><p>Thank You 😊😊</p><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div></div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-47361833471750502722022-02-02T01:59:00.000+05:302022-02-02T01:59:16.879+05:30How to connect MYSQL using C++ in Linux<p> Hello Everyone , So i was working on some project and there i've to connect MYSQL using C++ so i thought it will be great if i share that procedure to you.Then Let's begin....<span></span></p><a name='more'></a><p></p><p>So First of all you need mysql install in your Linux distro</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #d4d4d4;">sudo apt install mysql-client-core-</span><span style="color: #b5cea8;">8.0</span><span style="color: #d4d4d4;"> && sudo apt-get install mysql-server</span></div></div><p>Now start mysql service and check status if it's active or not</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #d4d4d4;">sudo service mysql start && sudo service mysql status</span></div></div><p><br /></p><p>Now create demosql.cpp file and include this lines</p><p></p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #c586c0;">#include</span><span style="color: #569cd6;"> </span><span style="color: #ce9178;"><stdlib.h></span></div><div><span style="color: #c586c0;">#include</span><span style="color: #569cd6;"> </span><span style="color: #ce9178;"><iostream></span></div><div><span style="color: #c586c0;">#include</span><span style="color: #569cd6;"> </span><span style="color: #ce9178;"><mysql_connection.h></span></div><div><span style="color: #c586c0;">#include</span><span style="color: #569cd6;"> </span><span style="color: #ce9178;"><mysql_driver.h></span><span style="color: #569cd6;"> </span></div><div><span style="color: #c586c0;">#include</span><span style="color: #569cd6;"> </span><span style="color: #ce9178;"><cppconn/resultset.h></span></div><div><span style="color: #c586c0;">#include</span><span style="color: #569cd6;"> </span><span style="color: #ce9178;"><cppconn/statement.h></span></div><div><span style="color: #c586c0;">#include</span><span style="color: #569cd6;"> </span><span style="color: #ce9178;"><cppconn/prepared_statement.h></span></div><br /><div><span style="color: #c586c0;">using</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">namespace</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">std</span><span style="color: #d4d4d4;">;</span></div><br /><div><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">main</span><span style="color: #d4d4d4;">(){</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">sql</span><span style="color: #d4d4d4;">::Driver *driver;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">sql</span><span style="color: #d4d4d4;">::Connection *con;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">sql</span><span style="color: #d4d4d4;">::Statement *stmt;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">sql</span><span style="color: #d4d4d4;">::PreparedStatement *pstmt;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">sql</span><span style="color: #d4d4d4;">::ResultSet *result;</span></div><br /><div><span style="color: #6a9955;"> // create driver instance </span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">try</span><span style="color: #d4d4d4;">{</span></div><div><span style="color: #d4d4d4;"> driver = </span><span style="color: #dcdcaa;">get_driver_instance</span><span style="color: #d4d4d4;">();</span></div><div><span style="color: #d4d4d4;"> con = </span><span style="color: #9cdcfe;">driver</span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">connect</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"tcp://127.0.0.1"</span><span style="color: #d4d4d4;">,</span><span style="color: #ce9178;">"database-name"</span><span style="color: #d4d4d4;">,</span><span style="color: #ce9178;">"password"</span><span style="color: #d4d4d4;">);<span></span><span></span></span><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #9cdcfe;"><span> </span><span> </span>con</span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">setSchema</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"database-name"</span><span style="color: #d4d4d4;">);</span></div></div><span style="color: #d4d4d4;"></span></div><div><span style="color: #d4d4d4;"> cout << </span><span style="color: #ce9178;">"Connection made Successfully"</span><span style="color: #d4d4d4;"> << endl;</span></div><div><span style="color: #d4d4d4;"> }</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">catch</span><span style="color: #d4d4d4;">(</span><span style="color: #4ec9b0;">sql</span><span style="color: #d4d4d4;">::SQLException e){</span></div><div><span style="color: #d4d4d4;"> cout << </span><span style="color: #ce9178;">"Unable to connect Erro: "</span><span style="color: #d4d4d4;"> << </span><span style="color: #9cdcfe;">e</span><span style="color: #d4d4d4;">.</span><span style="color: #dcdcaa;">what</span><span style="color: #d4d4d4;">() << endl;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">exit</span><span style="color: #d4d4d4;">(</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> }</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> </span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">;</span></div><br /><div><span style="color: #d4d4d4;">}</span></div></div><p>if it works then congratulations you've successfully made connection with MYSQL</p><p>but if did not work then don't worry we'll fix issue </p><p>first of all you need to compile above code with this command:</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #d4d4d4;">g++ </span><span style="color: #9cdcfe;">demosql</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">cpp</span><span style="color: #d4d4d4;"> -o demosql -lmysqlcppconn</span></div></div><p>still didn't work? it means you don't have "mysqlcppcon" then install it and update repository with</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #d4d4d4;">sudo apt-get install libmysqlcppconn-dev && sudo apt update</span></div></div><p>now try compile with </p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #d4d4d4;">g++ </span><span style="color: #9cdcfe;">demosql</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">cpp</span><span style="color: #d4d4d4;"> -o demosql -lmysqlcppconn</span></div></div><p>remember we'll compile always with above command ..and run with <span style="background-color: black;"><span style="color: #01ffff;">./demosql</span></span></p><p>Now you might have thinking what's next ?</p><p>then let's create function to run query</p><p>I am gonna create only one function where we write query and that function will execute that query (you can create different function your self)</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #569cd6;">bool</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">_execute</span><span style="color: #d4d4d4;">(</span><span style="color: #4ec9b0;">string</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">query</span><span style="color: #d4d4d4;">,</span><span style="color: #4ec9b0;">sql</span><span style="color: #d4d4d4;">::</span><span style="color: #4ec9b0;">Connection</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">*</span><span style="color: #9cdcfe;">con</span><span style="color: #d4d4d4;">,</span><span style="color: #4ec9b0;">sql</span><span style="color: #d4d4d4;">::</span><span style="color: #4ec9b0;">Statement</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">*</span><span style="color: #9cdcfe;">stmt</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;">{</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">try</span><span style="color: #d4d4d4;">{</span></div><br /><div><span style="color: #d4d4d4;"> stmt = </span><span style="color: #9cdcfe;">con</span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">createStatement</span><span style="color: #d4d4d4;">();</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">stmt</span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">execute</span><span style="color: #d4d4d4;">(query);</span></div><div><span style="color: #d4d4d4;"> cout << </span><span style="color: #ce9178;">"TRUE"</span><span style="color: #d4d4d4;"> << endl;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">true</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> }</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">catch</span><span style="color: #d4d4d4;">(</span><span style="color: #4ec9b0;">sql</span><span style="color: #d4d4d4;">::SQLException e){</span></div><div><span style="color: #d4d4d4;"> cout << </span><span style="color: #ce9178;">"Unable to perform query Error: "</span><span style="color: #d4d4d4;"> << </span><span style="color: #9cdcfe;">e</span><span style="color: #d4d4d4;">.</span><span style="color: #dcdcaa;">what</span><span style="color: #d4d4d4;">() << endl;</span></div><div><span style="color: #d4d4d4;"> cout << </span><span style="color: #ce9178;">"FALSE"</span><span style="color: #d4d4d4;"> << endl; </span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">exit</span><span style="color: #d4d4d4;">(</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">false</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> }</span></div><br /><div><span style="color: #d4d4d4;">}</span></div></div><p>Now you can use this function like belove,</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #dcdcaa;">_execute</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"CREATE TABLE demo1 (id serial PRIMARY KEY,</span></div><div><span style="color: #ce9178;"> name VARCHAR(50), quantity INTEGER);"</span><span style="color: #d4d4d4;">,con,stmt);</span></div></div><p>you can change query according to your preferences..</p><p>Now how can you improve this.</p><p>Create Class which handles function (which you will create for executing various query) and there are lot of things you can do.<br /></p><p>So that's all for today</p><p>Thank You 😊😊<br /></p><p><br /></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-35750139414783136042022-01-29T01:33:00.001+05:302022-05-23T18:49:04.464+05:30*args and **kwargs in Python<p> So here I'm gonna explain what are the *args and **kwargs, and what is their use of it. let's Begin</p><p><span></span></p><a name='more'></a><p></p><p>You can *args and **kwargs are the magic variables. so first of all it is not necessary to write *args and **kwargs, and only an asterisk (*) is needed also you can write *something and **somethings. it is just for understanding we take *args and **kwargs</p><h3 style="text-align: left;">*args:</h3><p>Assume we have a function name sum which takes two parameters X and Y and this function return sum of those two values. function code is below:</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #569cd6;">def</span> <span style="color: #dcdcaa;">sum</span>(<span style="color: #9cdcfe;">x</span>,<span style="color: #9cdcfe;">y</span>):</div><div> <span style="color: #c586c0;">return</span> x+y</div><div><span style="color: #dcdcaa;">print</span>(<span style="color: #dcdcaa;">sum</span>(<span style="color: #b5cea8;">10</span>,<span style="color: #b5cea8;">3</span>)) <span style="color: #6a9955;"># 13</span></div></div><p></p><blockquote><p>now we need function which can give us sum of three values so what if we pass three arguments in this function?</p><p><b>TypeError: sum() takes exactly 2 arguments (3 given)</b></p></blockquote><p><b></b></p><p>So we need to change our function definition but how many times have you will change it?</p><p>so for this type of situation, there is a magic variable called *args</p><p>function definition using *args is below:</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #569cd6;">def</span> <span style="color: #dcdcaa;">sum</span>(<span style="color: #9cdcfe;">x</span>,<span style="color: #9cdcfe;">y</span>,*<span style="color: #9cdcfe;">args</span>):</div><div> result = x + y</div><div> <span style="color: #c586c0;">for</span> i <span style="color: #c586c0;">in</span> args:</div><div> result += i</div><div> <span style="color: #c586c0;">return</span> result</div><div><span style="color: #dcdcaa;">print</span>(<span style="color: #dcdcaa;">sum</span>(<span style="color: #b5cea8;">10</span>,<span style="color: #b5cea8;">3</span>,<span style="color: #b5cea8;">14</span>,<span style="color: #b5cea8;">23</span>,<span style="color: #b5cea8;">25</span>)) <span style="color: #6a9955;"># 75</span></div></div><p>so this was basic knowledge about *args, I hope you understand the use of *args, Now let's move on to **kwargs</p><h3 style="text-align: left;">**kwargs:</h3><p>You should use **kwargs if you want to handle named arguments in a function, let me explain with example.</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div><span style="color: #569cd6;">def</span> <span style="color: #dcdcaa;">details</span>(**<span style="color: #9cdcfe;">kwargs</span>):</div><div> <span style="color: #c586c0;">for</span> key, value <span style="color: #c586c0;">in</span> kwargs.items():</div><div> <span style="color: #dcdcaa;">print</span>(<span style="color: #569cd6;">f</span><span style="color: #ce9178;">"</span><span style="color: #569cd6;">{</span>key<span style="color: #569cd6;">}</span><span style="color: #ce9178;"> = </span><span style="color: #569cd6;">{</span>value<span style="color: #569cd6;">}</span><span style="color: #ce9178;">"</span>)</div><br /><div>details(<span style="color: #9cdcfe;">name</span>=<span style="color: #ce9178;">"apnacodingadda"</span>,<span style="color: #9cdcfe;">subject</span>=<span style="color: #ce9178;">"Programming"</span>,<span style="color: #9cdcfe;">topic</span>=<span style="color: #ce9178;">"*args and **kwargs"</span>)</div><br /><div><span style="color: #6a9955;">#output:</span></div><div><span style="color: #6a9955;"># name = apnacodingadda</span></div><div><span style="color: #6a9955;"># subject = Programming</span></div><div><span style="color: #6a9955;"># topic = *args and **kwargs</span></div></div><p>So as you can see we handle a bunch of arguments with help of **kwargs so this was basically about **kwargs.</p><p></p><blockquote>Remember When we are using *args then Extra parameters (which *args handling those parameter) are stored in tuple and **kwargs stored those arguments in dictionary (as there are key,value pair)</blockquote><p></p><p>If you want to use them both and want some other must-pass parameter in function then the order would like this -- def func(other,*args,**kwargs) </p><p></p><blockquote><p>When to use them?</p><p>There are lot of use of *args and **kwargs . the most common use is in making function decorators.</p><p>and also these are use in Monkey Patching (modifying code at run time) </p></blockquote><p></p><p>So that was all basics about *args and **kwargs </p><p><br /></p><p>Thank You 😊😊</p><p><br /></p><p><br /></p><p><br /></p><p></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-6960586224460243312022-01-28T01:06:00.002+05:302022-01-29T00:35:08.081+05:30Find nth Fibonacci number --> Binet's Formula (Time = O(1) ??)<p> So title might have make you focus on this topic and also you are thinking of that is it really possible?</p><p>Yes it is.but not for every value of n, let's see more about in this post.<span></span></p><a name='more'></a><br /><p></p><div>So first what is fibonacci sequence ?</div><div>0 1 1 2 3 5 8 13 .............. (sum of every first and second number = every third number)</div><div>if you are interested in fibonacci even more then you can find out more detail <a href="https://en.wikipedia.org/wiki/Fibonacci_number" target="_blank">here</a></div><div><br /></div><div>first let's discuss what are other way of getting nth fibonacci number?(here i am using c++)</div><div>Method 1: Recursion</div><div><br /></div><div><pre data-darkreader-inline-bgcolor="" data-darkreader-inline-bgimage="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #121a1d; --darkreader-inline-bgimage: initial; --darkreader-inline-color: #c3beb6; background: rgb(23, 32, 36); border-radius: 3px; box-sizing: border-box; color: #cac6bf; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13px; line-height: 1.6; margin-bottom: 1em; margin-top: 0px; overflow: auto; padding: 10px 15px; user-select: auto;"><code data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: transparent; --darkreader-inline-color: inherit; background-color: transparent; border-radius: 3px; box-sizing: border-box; color: inherit; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 0px; tab-size: 4; user-select: auto;"> int <span class="hljs-function" style="box-sizing: border-box; user-select: auto;"><span class="hljs-title" data-darkreader-inline-color="" style="--darkreader-inline-color: #5d43ff; box-sizing: border-box; color: #563bff; user-select: auto;">fib</span>(<span class="hljs-params" data-darkreader-inline-color="" style="--darkreader-inline-color: #a16fdb; box-sizing: border-box; color: #9f6bda; user-select: auto;">int N</span>)</span> {
<span class="hljs-keyword" data-darkreader-inline-color="" style="--darkreader-inline-color: #f25cdb; box-sizing: border-box; color: #f259da; user-select: auto;">if</span>(N == <span class="hljs-number" data-darkreader-inline-color="" style="--darkreader-inline-color: #5d43ff; box-sizing: border-box; color: #563bff; user-select: auto;">0</span>) <span class="hljs-keyword" data-darkreader-inline-color="" style="--darkreader-inline-color: #f25cdb; box-sizing: border-box; color: #f259da; user-select: auto;">return</span> <span class="hljs-number" data-darkreader-inline-color="" style="--darkreader-inline-color: #5d43ff; box-sizing: border-box; color: #563bff; user-select: auto;">0</span>;
<span class="hljs-keyword" data-darkreader-inline-color="" style="--darkreader-inline-color: #f25cdb; box-sizing: border-box; color: #f259da; user-select: auto;">if</span>(N == <span class="hljs-number" data-darkreader-inline-color="" style="--darkreader-inline-color: #5d43ff; box-sizing: border-box; color: #563bff; user-select: auto;">1</span>) <span class="hljs-keyword" data-darkreader-inline-color="" style="--darkreader-inline-color: #f25cdb; box-sizing: border-box; color: #f259da; user-select: auto;">return</span> <span class="hljs-number" data-darkreader-inline-color="" style="--darkreader-inline-color: #5d43ff; box-sizing: border-box; color: #563bff; user-select: auto;">1</span>;
<span class="hljs-keyword" data-darkreader-inline-color="" style="--darkreader-inline-color: #f25cdb; box-sizing: border-box; color: #f259da; user-select: auto;">return</span> fib(N-<span class="hljs-number" data-darkreader-inline-color="" style="--darkreader-inline-color: #5d43ff; box-sizing: border-box; color: #563bff; user-select: auto;">1</span>) + fib(N-<span class="hljs-number" data-darkreader-inline-color="" style="--darkreader-inline-color: #5d43ff; box-sizing: border-box; color: #563bff; user-select: auto;">2</span>);
}</code></pre></div><div>Time Complexity : O(2^N)</div><div>Space Complexity : O(N) (because of function call stack size)</div><div><br /></div><div>Method 2 : DP with Memoization</div><div><br /></div><div><div style="background-color: #1e1e1e; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div style="color: #d4d4d4;"> <span style="color: #569cd6;">int</span> <span style="color: #dcdcaa;">fib</span>(<span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">N</span>) {</div><div style="color: #d4d4d4;"> <span style="color: #c586c0;">if</span>(<span style="color: #9cdcfe;">N</span> < <span style="color: #b5cea8;">2</span>)</div><div style="color: #d4d4d4;"> <span style="color: #c586c0;">return</span> <span style="color: #9cdcfe;">N</span>;</div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">int</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">memo</span><span style="color: #d4d4d4;">[</span><span style="color: #9cdcfe;">N</span><span style="color: #d4d4d4;">+</span><span style="color: #b5cea8;">2</span><span style="color: #d4d4d4;">];</span></div><div style="color: #d4d4d4;"> <span style="color: #9cdcfe;">memo</span>[<span style="color: #b5cea8;">0</span>] = <span style="color: #b5cea8;">0</span>;</div><div style="color: #d4d4d4;"> <span style="color: #9cdcfe;">memo</span>[<span style="color: #b5cea8;">1</span>] = <span style="color: #b5cea8;">1</span>;</div><div style="color: #d4d4d4;"> <span style="color: #c586c0;">for</span>(<span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">i</span>=<span style="color: #b5cea8;">2</span>; <span style="color: #9cdcfe;">i</span><=<span style="color: #9cdcfe;">N</span>; <span style="color: #9cdcfe;">i</span>++)</div><div style="color: #d4d4d4;"> <span style="color: #9cdcfe;">memo</span>[<span style="color: #9cdcfe;">i</span>] = <span style="color: #9cdcfe;">memo</span>[<span style="color: #9cdcfe;">i</span>-<span style="color: #b5cea8;">1</span>] + <span style="color: #9cdcfe;">memo</span>[<span style="color: #9cdcfe;">i</span>-<span style="color: #b5cea8;">2</span>];</div><div style="color: #d4d4d4;"> <span style="color: #c586c0;">return</span> <span style="color: #9cdcfe;">memo</span>[<span style="color: #9cdcfe;">N</span>];</div><div style="color: #d4d4d4;"> }</div></div></div><div><br /></div><div>Time Complexity : O(N)</div><div>Space Complexity : O(N)</div><div><br /></div><div>Method 3 : DP</div><div><br /></div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div> <span style="color: #569cd6;">int</span> <span style="color: #dcdcaa;">fib</span>(<span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">N</span>) {</div><div> <span style="color: #c586c0;">if</span>(<span style="color: #9cdcfe;">N</span> < <span style="color: #b5cea8;">2</span>) </div><div> <span style="color: #c586c0;">return</span> <span style="color: #9cdcfe;">N</span>;</div><div> <span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">a</span> = <span style="color: #b5cea8;">0</span>, <span style="color: #9cdcfe;">b</span> = <span style="color: #b5cea8;">1</span>, <span style="color: #9cdcfe;">c</span> = <span style="color: #b5cea8;">0</span>;</div><div> <span style="color: #c586c0;">for</span>(<span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">i</span> = <span style="color: #b5cea8;">1</span>; <span style="color: #9cdcfe;">i</span> < <span style="color: #9cdcfe;">N</span>; <span style="color: #9cdcfe;">i</span>++)</div><div> {</div><div> <span style="color: #9cdcfe;">c</span> = <span style="color: #9cdcfe;">a</span> + <span style="color: #9cdcfe;">b</span>;</div><div> <span style="color: #9cdcfe;">a</span> = <span style="color: #9cdcfe;">b</span>;</div><div> <span style="color: #9cdcfe;">b</span> = <span style="color: #9cdcfe;">c</span>;</div><div> }</div><div> <span style="color: #c586c0;">return</span> <span style="color: #9cdcfe;">c</span>;</div><div> }</div></div></div><div><br /></div><div>Time Complexity : O(N)</div><div>Space Complexity : O(1)</div><div><br /></div><div>Method 4: Binet's Fiibonacci number formula</div><div><br /></div><div>Real formula is : (pow(1+sqrt(5),n)- pow(1-sqrt(5),n) /pow(2,n*sqrt(5)))</div><div>but for we'll use little small formula for program you can use above formula too.</div><div>this method won't give perfect result for too large value of N</div><div><br /></div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; line-height: 19px; white-space: pre;"><div> <span style="color: #569cd6;">int</span> <span style="color: #dcdcaa;">fib</span>(<span style="color: #569cd6;">int</span> <span style="color: #9cdcfe;">N</span>) {</div><div> <span style="color: #569cd6;">double</span> <span style="color: #9cdcfe;">phi</span> = (<span style="color: #dcdcaa;">sqrt</span>(<span style="color: #b5cea8;">5</span>) + <span style="color: #b5cea8;">1</span>) / <span style="color: #b5cea8;">2</span>; </div><div> <span style="color: #c586c0;">return</span> <span style="color: #dcdcaa;">round</span>(<span style="color: #dcdcaa;">pow</span>(<span style="color: #9cdcfe;">phi</span>, <span style="color: #9cdcfe;">N</span>) / <span style="color: #dcdcaa;">sqrt</span>(<span style="color: #b5cea8;">5</span>));</div><div> }</div></div></div><div><br /></div><div>Time Complexity : O(1)</div><div>Space Complexity : O(1)</div><div><br /></div><div>If you want to know more about <a href="http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fibFormula.html" target="_blank">binet's Formula for nth fibonacci number</a> it's <a href="http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fibFormula.html">here</a></div><div><br /></div><div>Note: above shown time complexity is according to c++ becuase for c++ pow() takes O(1) (also depend on architecture) more detail is <a href="https://stackoverflow.com/questions/13418180/time-complexity-of-c-math-library-pow-function" target="_blank">here</a> . for some programming language it uses log(N)</div><div><br /></div><div>If you have any thoughts feel free to share in comment section.</div><div><br /></div><div>Thank You 😊😊</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-33205333020559274692022-01-25T01:10:00.007+05:302022-01-25T01:21:45.848+05:30How to create website on Dark WEB?<p> In this post we're gonna create website on Dark WEB, yeah you read it right on Dark WEB. What we need ? just Linux nothing more. Linux can be on your Rasberry Pi or on Virtual machine or on your PC, it will work. you've Linux then Let's begin....<span></span></p><a name='more'></a> <div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEijIBWC4bJ6_xkwupzk1_Iw4jebSQV0ehhZsmibMJUvGcSUzzB8xUb5Z7PW7AT_lIyDjsJ9Tc4tCFnrxDm5tsTCQHkU_ECAg_ef3fzdemep7Eyht2TbWTzroDVoApqMsFCKG-4lehDV29UIZNAgpdoGBCLbdlOp_4thZOsVBCu3E8qxkCIIBeHzqOEW=s318" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="159" data-original-width="318" height="214" src="https://blogger.googleusercontent.com/img/a/AVvXsEijIBWC4bJ6_xkwupzk1_Iw4jebSQV0ehhZsmibMJUvGcSUzzB8xUb5Z7PW7AT_lIyDjsJ9Tc4tCFnrxDm5tsTCQHkU_ECAg_ef3fzdemep7Eyht2TbWTzroDVoApqMsFCKG-4lehDV29UIZNAgpdoGBCLbdlOp_4thZOsVBCu3E8qxkCIIBeHzqOEW=w428-h214" width="428" /></a></div><div><br /><p></p><h3 style="text-align: left;"><u>Step 1: update your repository on your Linux Environment </u></h3></div><div><p style="text-align: left;"><span style="background-color: black; color: white;">sudo apt update </span></p></div><div><h3 style="text-align: left;"><u>Step 2: Download tor (don't worry it's so simple and it's not Tor it's tor)</u></h3><p>what is the difference between "tor" and "Tor"?</p></div>tor is the daemon. in simple language it's program which runs tor services in your Environment.<br /><div style="text-align: left;"><p>Tor is Browser where we will access our website</p></div><div style="text-align: left;"><span style="background-color: #f4cccc;"><br /></span></div><div style="text-align: left;"><span style="background-color: black; color: white;">sudo apt install tor </span></div><div><h3 style="text-align: left;"><u> Step 3: getting onion address for website</u></h3><p style="text-align: left;"><span style="background-color: black; color: white;">sudo nano /etc/tor/torrc</span></p><p>uncomment those two line(white line) then save it by pressing CTRL + X and then press Y then ENTER</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEiZy6JwevkW80tePrRwZUM9Y50ZOxHqqPGAKAyGQauyssQQPK5_XjIcshiAmOOLiEebTKby9_xWn-1dsqBX124N7p0_MOe032IWMKD6aOsPAN-H-GKDvxdNzBw1jPrQut9Zb3g5m0S5BsCyP_YBEZ3Y2KfPgFqwj5XglXGfb9xGFlxtlMQe8-Uj_4NH=s872" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="536" data-original-width="872" height="340" src="https://blogger.googleusercontent.com/img/a/AVvXsEiZy6JwevkW80tePrRwZUM9Y50ZOxHqqPGAKAyGQauyssQQPK5_XjIcshiAmOOLiEebTKby9_xWn-1dsqBX124N7p0_MOe032IWMKD6aOsPAN-H-GKDvxdNzBw1jPrQut9Zb3g5m0S5BsCyP_YBEZ3Y2KfPgFqwj5XglXGfb9xGFlxtlMQe8-Uj_4NH=w552-h340" width="552" /></a></div><p>Now start tor service in your Environment by</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo service tor start</span></p><p>check if it is actually running or not?</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo service tor status </span></p><p>then for getting your onion address(not your but your website's 😝😝 )</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo cat /var/lib/hidden_service/hostname</span></p><p>and that's your onion address of your website . Wait we're not done yet </p><p> Now we need show something on our website then let's set up our website</p><h3 style="text-align: left;"><u>Step 4: Set up website</u></h3><p>first you need "nginx" so let's install it</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo apt install nginx</span></p><p>Now start nginx service </p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo service nginx start</span></p><p>check if it is actually running or not?</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo service nginx status</span></p><p>Now paste your onion address in Tor browser and BOOM your website is on darkweb.</p><p>I know website looks so ugly. then let's make little good. </p><p>But first let's make our website little more safer.</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo nano /etc/nginx/nginx.conf</span></p><p>And now just copy like this image</p><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEj-BwbV_ej_3rMwrAi76gKRkKz4TpN2JlKlHeqNhd2M9YwoNQvZP8V_flaFX2qYrgUUJn88sUpjusKMQNRhZyVrRmEq-Aaj3SQcrFq2XAcG_OJx3lvmHqVLhQxJquJCPb-CRUk8kBxy_g91ci1g0ZmezaJfk0heWWiJESAkHMQsE62r-xRMPwdXqWH-=s952" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="557" data-original-width="952" height="331" src="https://blogger.googleusercontent.com/img/a/AVvXsEj-BwbV_ej_3rMwrAi76gKRkKz4TpN2JlKlHeqNhd2M9YwoNQvZP8V_flaFX2qYrgUUJn88sUpjusKMQNRhZyVrRmEq-Aaj3SQcrFq2XAcG_OJx3lvmHqVLhQxJquJCPb-CRUk8kBxy_g91ci1g0ZmezaJfk0heWWiJESAkHMQsE62r-xRMPwdXqWH-=w557-h331" width="557" /></a></div><br /> Now restart nginx service<p></p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo service nginx restart</span></p><p>and check status</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo service nginx status</span></p><p>Now let's change html of our webisite,</p><p style="text-align: left;"><span style="background-color: black; color: white;">cd /var/www/html/</span></p><p>now delete .html file in that directory and create index.html file and customize as per your choice,</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo rm index.nginx-debian.html</span></p><p>and create index.html,</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo touch index.html </span></p><p>and modify it</p><p style="text-align: left;"><span style="background-color: black; color: white;">sudo nano index.html</span></p><p>and once again restart nginx and check your website </p><p><br /></p><p>I hope you like this post </p><p>Thank You 😊😊</p><p> </p></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-53405122731360568972022-01-21T00:50:00.002+05:302022-01-21T22:23:52.821+05:30What are the NFTs? How to earn , create and trade ?<p> So you might have heard of this term "NFTs". so what are this NFTs means. let's talk about this new thing exists in this world of internet.<span></span></p><a name='more'></a><p style="text-align: left;"><br /></p><p style="text-align: left;">NFT stands for<b> Non-fungible token</b>. As per <a href="https://en.wikipedia.org/wiki/Non-fungible_token" target="_blank">Wikipedia</a> NFT is a non-interchangeable unit of data stored on a blockchain, a form of digital ledger.[1] Types of NFT data units include digital files such as photos, videos, and audio. Because each token is uniquely identifiable, NFTs differ from blockchain cryptocurrencies, such as Bitcoin.</p>So NFT can be anything which is unique or you can say which is not capable of being interchange.<div>Like you can see in below image which is of <span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #131516; --darkreader-inline-color: #c4bfb7; background-color: #181a1b; color: #ccc7c0; font-family: "Helvetica Neue", Helvetica, OpenSans, Arial, sans-serif; font-size: 16px; font-weight: 700;">Bored Ape Yacht Club </span>and price of this nft is in millions of dollar(while writing this post)</div><div><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEh4Y2wS9IqGvDRZE9vNtm9fdC8wbt29jNIDyM6v6BuE-suTw_5R6jBgsJ33zGUJ0iHnqJpkQzSSOSas3LZunWI6wPijmrFiM5nZ9SFfdrMTVEgBKtUUqqsk_JkgV4NiN7eKzlHsyb3pYucn-rEvdaZCJgEzsWCXF6r86ojTY_J0sIJlNJtkFkaKw09M=s720" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="378" data-original-width="720" height="168" src="https://blogger.googleusercontent.com/img/a/AVvXsEh4Y2wS9IqGvDRZE9vNtm9fdC8wbt29jNIDyM6v6BuE-suTw_5R6jBgsJ33zGUJ0iHnqJpkQzSSOSas3LZunWI6wPijmrFiM5nZ9SFfdrMTVEgBKtUUqqsk_JkgV4NiN7eKzlHsyb3pYucn-rEvdaZCJgEzsWCXF6r86ojTY_J0sIJlNJtkFkaKw09M=s320" width="320" /></a></div><br /><div><br /></div><p style="text-align: left;">NFT can be your own digital art or your own music album anything which is unique and not capable of being change is NFT.</p></div><p style="text-align: left;">NFT ledgers claim to provide a public certificate of authenticity or proof of ownership, but the legal rights conveyed by an NFT can be uncertain. NFTs do not restrict the sharing or copying of the underlying digital files and do not prevent the creation of NFTs with identical associated files. NFT purchasers do not generally acquire the copyright of the underlying artwork.</p><p style="text-align: left;">In games if you are buying gun skin and different character it is also NFT. If you have made any digital art or you have recorded your song then it is also NFT.</p><p style="text-align: left;">Twitter CEO Jack Dorsey sold his first ever tweet for 2.9 Million dollars as an NFT. and also NBA sold Top shot moments in millions of dollars and there are many celebrities who are interested and selling there digital art as NFT.</p><div>if you want to trade in NFTs then you can visit <a href="http://OpenSea.io">OpenSea.io</a> </div><div><br /></div><h3 style="text-align: left;">So how NFTs price fluctuate?</h3><p style="text-align: justify;"><span style="text-align: justify;">This is just my opinion, what i think is it all about Human Psychology . we human have different type of desire when we see any new thing , and we want that new thing because everyone is talking about it and everyone is buying that thing. so that's how price of NFTS or any other digital currency's fluctuate. <br /></span>In March 2021 Mike Winkelmann called NFTs an "irrational exuberance bubble".</p><div><br /></div><div>But still you should not miss this opportunity in NFT world who knows what is future?</div><div><br /></div><h3 style="text-align: left;">So now you want some NFTs, don't you 😆?</h3><div>Let me tell you how to get Free NFTs</div><div><a href="http://OpenSea.io">OpenSea.io</a> has launched a collection manager feature that lets you create your own NFTs for free without paying any gas(Transaction fee) charges.</div><div>You can earn NFTs while playing games too there is game called <a href="https://play.alienworlds.io/">Alien world</a> where you can earn NFTs.</div><div><br /></div><div><br /></div><div>Let me know you thoughts about NFTs in comment section...</div><div><br /></div><div>Thank You 😊😊</div><div><br /></div><div><p style="text-align: center;"><b><u>Other Important Post</u></b></p><ul><li><a href="https://apnacodingadda.blogspot.com/2021/11/singly-linked-list-with-python-data.html#more">Learn Singly Linked List</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/doubly-linked-list-basic-sorting-with.html#more">Learn Doubly Linked List</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/10/hangman-game.html#more">Create Hangman Game using Python</a><br /></li><li><a href="https://apnacodingadda.blogspot.com/2021/10/rock-paper-scissor-game.html#more">Create Rock Paper Scissor Game using Tkinter</a></li></ul></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-63223132283073756172021-11-23T23:10:00.002+05:302021-11-24T10:07:45.092+05:30Extension : Create , Publish and Earn<div><p> Today we'll learn How to create Extension/add-ons , How to Publish it and Earn from it.So Let's begin......<span></span></p><a name='more'></a><p><b></b></p><div class="separator" style="clear: both; text-align: center;"><b><a href="https://blogger.googleusercontent.com/img/a/AVvXsEjdKX7I-PZjBN0EdOnsl7i9QjN_felytwh6MU75v7MvRV3lM2fiMFiLRTR2REW_MFCieinuXW98NO40sPOU1D62gPaAGAZhRAczb7uqTpphPp0qEpFt22XL1jl5IIohXD0TbO_Z6IREY2RdEB17CnaxnzxYWnPBMYIWwKSKKiR32rwxszgoD6vvacj_=s977" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="977" data-original-width="900" height="320" src="https://blogger.googleusercontent.com/img/a/AVvXsEjdKX7I-PZjBN0EdOnsl7i9QjN_felytwh6MU75v7MvRV3lM2fiMFiLRTR2REW_MFCieinuXW98NO40sPOU1D62gPaAGAZhRAczb7uqTpphPp0qEpFt22XL1jl5IIohXD0TbO_Z6IREY2RdEB17CnaxnzxYWnPBMYIWwKSKKiR32rwxszgoD6vvacj_=s320" width="295" /></a></b></div><b><br /> </b><p></p><p><b>Extensions</b> are small software which allows you to customize browser. There are many types of extensions like ad-block , cookie manager, for Emoji , password manager etc.</p><p>Extensions are made of different, but common, components. Components can include background scripts, content scripts, other pages, and various logic files.</p><p>So let's Create one,</p><h3 style="text-align: left;"><u>Creation:</u></h3><p style="margin-left: 40px; text-align: left;">Step 1: First we'll create manifest.json</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #d4d4d4;">{</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"name"</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">"Apna Coding Adda"</span><span style="color: #d4d4d4;">,</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"version"</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">"0.0.1"</span><span style="color: #d4d4d4;">,</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"description"</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">"Coding Blogspot"</span><span style="color: #d4d4d4;">,</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"permissions"</span><span style="color: #d4d4d4;">: [</span><span style="color: #ce9178;">"activeTab"</span><span style="color: #d4d4d4;">],</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"browser_action"</span><span style="color: #d4d4d4;">: {</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"default_popup"</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">"popup.html"</span><span style="color: #d4d4d4;">,</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"scripts"</span><span style="color: #d4d4d4;">: [</span><span style="color: #ce9178;">"background.js"</span><span style="color: #d4d4d4;">],</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"persistent"</span><span style="color: #d4d4d4;">: </span><span style="color: #569cd6;">false</span><span style="color: #d4d4d4;">,</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"default_icon"</span><span style="color: #d4d4d4;">: {</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"16"</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">"img/icon16.png"</span><span style="color: #d4d4d4;">,</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"32"</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">"img/icon32.png"</span><span style="color: #d4d4d4;">,</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"48"</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">"img/icon48.png"</span></div><div><span style="color: #d4d4d4;"> }</span></div><div><span style="color: #d4d4d4;"> },</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">"manifest_version"</span><span style="color: #d4d4d4;">: </span><span style="color: #b5cea8;">2</span></div><div><span style="color: #d4d4d4;">}</span></div></div><p style="margin-left: 40px; text-align: left;">Here i am creating simple extension which will show user to <a href="https://apnacodingadda.blogspot.com/">Apna Coding Adda</a> , for your extension you can add feature as per your convenience.</p><p style="margin-left: 40px; text-align: left;">and also create folder name img and add icon for your extension in it. <br /></p><p style="margin-left: 40px; text-align: left;">Fill manifest.json according to your Extension</p><p style="margin-left: 40px; text-align: left;">Step 2: Design and add logic to your extension.<br /></p><p style="margin-left: 40px; text-align: left;">Don't worry we're gonna use HTML, CSS and JavaScript.</p><p style="margin-left: 40px; text-align: left;">Create popup.html</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: grey;"><</span><span style="color: #569cd6;">html</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">lang</span><span style="color: #d4d4d4;">=</span><span style="color: #ce9178;">"en"</span><span style="color: grey;">></span></div><div><span style="color: grey;"><</span><span style="color: #569cd6;">head</span><span style="color: grey;">></span></div><div><span style="color: #d4d4d4;"> </span><span style="color: grey;"><</span><span style="color: #569cd6;">meta</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">charset</span><span style="color: #d4d4d4;">=</span><span style="color: #ce9178;">"UTF-8"</span><span style="color: grey;">></span></div><div><span style="color: #d4d4d4;"> </span><span style="color: grey;"><</span><span style="color: #569cd6;">meta</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">http-equiv</span><span style="color: #d4d4d4;">=</span><span style="color: #ce9178;">"X-UA-Compatible"</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">content</span><span style="color: #d4d4d4;">=</span><span style="color: #ce9178;">"IE=edge"</span><span style="color: grey;">></span></div><div><span style="color: #d4d4d4;"> </span><span style="color: grey;"><</span><span style="color: #569cd6;">meta</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">name</span><span style="color: #d4d4d4;">=</span><span style="color: #ce9178;">"viewport"</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">content</span><span style="color: #d4d4d4;">=</span><span style="color: #ce9178;">"width=device-width, initial-scale=1.0"</span><span style="color: grey;">></span></div><div><span style="color: #d4d4d4;"> </span><span style="color: grey;"><</span><span style="color: #569cd6;">title</span><span style="color: grey;">></span><span style="color: #d4d4d4;">Apna coding Adda</span><span style="color: grey;"></</span><span style="color: #569cd6;">title</span><span style="color: grey;">></span></div><div><span style="color: grey;"></</span><span style="color: #569cd6;">head</span><span style="color: grey;">></span></div><div><span style="color: grey;"><</span><span style="color: #569cd6;">body</span><span style="color: grey;">></span></div><div><span style="color: #d4d4d4;"> </span><span style="color: grey;"><</span><span style="color: #569cd6;">h3</span><span style="color: grey;">></span><span style="color: #d4d4d4;">Apna Coding Adda</span><span style="color: grey;"></</span><span style="color: #569cd6;">h3</span><span style="color: grey;">></span></div><div><span style="color: #d4d4d4;"> </span><span style="color: grey;"><</span><span style="color: #569cd6;">button</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">id</span><span style="color: #d4d4d4;">=</span><span style="color: #ce9178;">"blog"</span><span style="color: grey;">></span><span style="color: #d4d4d4;">Click</span><span style="color: grey;"></</span><span style="color: #569cd6;">button</span><span style="color: grey;">></span></div><div><span style="color: grey;"><</span><span style="color: #569cd6;">script</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">src</span><span style="color: #d4d4d4;">=</span><span style="color: #ce9178;">"./app.js"</span><span style="color: grey;">></</span><span style="color: #569cd6;">script</span><span style="color: grey;">></span></div><div><span style="color: grey;"></</span><span style="color: #569cd6;">body</span><span style="color: grey;">></span></div><div><span style="color: grey;"></</span><span style="color: #569cd6;">html</span><span style="color: grey;">></span></div></div><p style="margin-left: 40px; text-align: left;"> and Now style.css</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">*</span><span style="color: #d4d4d4;">{</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">background-color</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">black</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;">}</span></div><div><span style="color: #d7ba7d;">h3</span><span style="color: #d4d4d4;">{</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">color</span><span style="color: #d4d4d4;">: </span><span style="color: #dcdcaa;">rgb</span><span style="color: #d4d4d4;">(</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">, </span><span style="color: #b5cea8;">183</span><span style="color: #d4d4d4;">, </span><span style="color: #b5cea8;">255</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;">}</span></div><div><span style="color: #d7ba7d;">#blog</span><span style="color: #d4d4d4;">{</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">display</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">block</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">margin</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">auto</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">background-color</span><span style="color: #d4d4d4;">: </span><span style="color: #dcdcaa;">rgb</span><span style="color: #d4d4d4;">(</span><span style="color: #b5cea8;">248</span><span style="color: #d4d4d4;">, </span><span style="color: #b5cea8;">117</span><span style="color: #d4d4d4;">, </span><span style="color: #b5cea8;">117</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">color</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">white</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">cursor</span><span style="color: #d4d4d4;">: </span><span style="color: #ce9178;">pointer</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">border</span><span style="color: #d4d4d4;">: </span><span style="color: #dcdcaa;">rgb</span><span style="color: #d4d4d4;">(</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">, </span><span style="color: #b5cea8;">183</span><span style="color: #d4d4d4;">, </span><span style="color: #b5cea8;">255</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">border-radius</span><span style="color: #d4d4d4;">: </span><span style="color: #b5cea8;">5px</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;">}</span></div></div><p><span> app.js</span></p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">let</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">blog</span><span style="color: #d4d4d4;"> = </span><span style="color: #9cdcfe;">document</span><span style="color: #d4d4d4;">.</span><span style="color: #dcdcaa;">getElementById</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">'blog'</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #9cdcfe;">blog</span><span style="color: #d4d4d4;">.</span><span style="color: #dcdcaa;">addEventListener</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"click"</span><span style="color: #d4d4d4;">, </span><span style="color: #569cd6;">async</span><span style="color: #d4d4d4;"> () </span><span style="color: #569cd6;">=></span><span style="color: #d4d4d4;"> {</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">window</span><span style="color: #d4d4d4;">.</span><span style="color: #9cdcfe;">location</span><span style="color: #d4d4d4;"> = </span><span style="color: #ce9178;">'https://apnacodingadda.blogspot.com/'</span><span style="color: #d4d4d4;">;</span></div><div><span style="color: #d4d4d4;"> });</span></div></div><p style="margin-left: 40px; text-align: left;"><span><span></span>Step 3: add to browser</span></p><p style="margin-left: 40px; text-align: left;"><span>For chrome: go to </span><code>chrome://extensions <span style="font-family: inherit;"><span style="font-family: georgia;">, Enable Developer mode and click on <span> </span>Load unpacked and select manifest.json</span></span></code></p><p style="margin-left: 40px; text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;">For Firefox: go to about:addons , click on settings and click Debug add-ons then click on Load Temporary add-ons and select manifest.json <br /></span></span></code></p><p style="text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;"><code><span style="font-family: inherit;"><span style="font-family: georgia;">Now you know what time it is? it is disco time 💃💃💃 😂😂😂........</span></span></code></span></span></code></p><p style="text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;"><code><span style="font-family: inherit;"><span style="font-family: georgia;">because</span></span></code> you created your first extension, so your Extension is ready to use and you can add more feature in it.</span></span></code></p><h3 style="text-align: left;"><u><code><span style="font-family: inherit;"><span style="font-family: georgia;">Publishing Extension:</span></span></code></u></h3><p style="margin-left: 40px; text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;">Step 1: Create Zip of your Extension Folder</span></span></code></p><p style="margin-left: 40px; text-align: left;"><a href="https://developer.chrome.com/docs/webstore/register/" target="_blank"><code><span style="font-family: inherit;"><span style="font-family: georgia;">Step 2: Create Developer account (cost USD 5$)</span></span></code></a></p><p style="margin-left: 40px; text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;">Step 3: Upload </span></span></code></p><p style="margin-left: 40px; text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;">Step 4: </span></span></code><code><span style="font-family: inherit;"><span style="font-family: georgia;">Add assets for your listing</span></span></code></p><p style="margin-left: 40px; text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;">Step 5: Submit for Publishing </span></span></code></p><p style="text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;"><br /></span></span></code></p><h3 style="text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;">Earning:</span></span></code></h3><p style="text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;">Now it is the main part.. Earning form exension.</span></span></code></p><ul style="text-align: left;"><li><code><span style="font-family: inherit;"><span style="font-family: georgia;">Sell Advertising </span></span></code></li><li><code><span style="font-family: inherit;"><span style="font-family: georgia;">paid Exension</span></span></code></li><li><code><span style="font-family: inherit;"><span style="font-family: georgia;">Subscription</span></span></code></li><li><code><span style="font-family: inherit;"><span style="font-family: georgia;">Ask for donations</span></span></code></li><li><code><span style="font-family: inherit;"><span style="font-family: georgia;">Etc</span></span></code></li></ul></div><p><code><span style="font-family: inherit;"><span style="font-family: georgia;"></span></span></code></p><p><code><span style="font-family: inherit;"><span style="font-family: georgia;"><br /></span></span></code></p><p><code><span style="font-family: inherit;"><span style="font-family: georgia;">Thank You 😊😊<br /></span></span></code></p><div><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-left: 1em; text-align: left;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhrf46xxMfIqyri0EPCXx0w2apzvkE6bhy-WxcRs61Uumc8XhZB5L4hdeA1-HKv9s0ib5yRp8jduvR9LvAC21175kLwb8E4QeL8e2j-tzNq9UVOztJVeUeK4jRGchX0BcNqkP_JCmALj_AEtv_DkyBt8wmyMirttHqKZCMp96gAsobuxHgMkPqiNNqa=s64" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" data-original-height="64" data-original-width="64" height="27" src="https://blogger.googleusercontent.com/img/a/AVvXsEhrf46xxMfIqyri0EPCXx0w2apzvkE6bhy-WxcRs61Uumc8XhZB5L4hdeA1-HKv9s0ib5yRp8jduvR9LvAC21175kLwb8E4QeL8e2j-tzNq9UVOztJVeUeK4jRGchX0BcNqkP_JCmALj_AEtv_DkyBt8wmyMirttHqKZCMp96gAsobuxHgMkPqiNNqa=w30-h27" width="30" /></a></td></tr><tr align="left"><td class="tr-caption"><a href="https://github.com/arth2002">GitHub</a></td></tr></tbody></table><p style="text-align: left;"><code></code></p><p style="text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;"> </span></span></code></p><p style="text-align: left;"><code><span style="font-family: inherit;"><span style="font-family: georgia;"> </span></span></code></p><p style="text-align: center;"><b><u>Other Important Post</u></b></p><ul><li><a href="https://apnacodingadda.blogspot.com/2021/11/singly-linked-list-with-python-data.html#more">Learn Singly Linked List</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/doubly-linked-list-basic-sorting-with.html#more">Learn Doubly Linked List</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/10/hangman-game.html#more">Create Hangman Game using Python</a><br /></li><li><a href="https://apnacodingadda.blogspot.com/2021/10/rock-paper-scissor-game.html#more">Create Rock Paper Scissor Game using Tkinter</a></li></ul><p></p></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-8077780419910535392021-11-17T15:07:00.003+05:302021-11-23T23:10:25.189+05:30Coding Problems : Hacker Rank (Separate The Numbers)<div><p> Here I found one interesting question from <a href="https://www.hackerrank.com/">Hacker Rank</a>, So Let's dig into question and write code....</p><a name='more'></a><p></p><p>Question you can see <a href="https://www.hackerrank.com/challenges/three-month-preparation-kit-separate-the-numbers/problem?isFullScreen=true&h_l=interview&playlist_slugs%5B%5D=preparation-kits&playlist_slugs%5B%5D=three-month-preparation-kit&playlist_slugs%5B%5D=three-month-week-four" target="_blank">Here</a></p><p>Note: Read the question and try to understand and solve it.</p><p>Here we'll see two different ways to solve it..</p><h4 style="text-align: left;">Method 1:</h4><ul style="text-align: left;"><li><b> Iterative Method:</b></li></ul></div><br /><div data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="--darkreader-inline-bgcolor: #171819; --darkreader-inline-color: #cdc8c2; background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 15.4px; font-weight: normal; line-height: 20px; margin-left: 40px; text-align: left; white-space: pre;"><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #86b173; color: #6a9955;"># for ex. s = "91011"</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #60a4d8; color: #569cd6;">def</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">separateNumbers</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #87d5fe; color: #9cdcfe;">s</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">):</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> res = </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">'NO'</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #c688c1; color: #c586c0;">for</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> i </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #c688c1; color: #c586c0;">in</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">range</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">len</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(s)):</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #86b173; color: #6a9955;">#i = 0 , starting digit = 9</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> starting_digit = </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #5ccdb6; color: #4ec9b0;">int</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(s[ : i + </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #afcaa1; color: #b5cea8;">1</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">])</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> new_s = </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #5ccdb6; color: #4ec9b0;">str</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(starting_digit)</span></div><br /><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #86b173; color: #6a9955;">#len(new_s) = 1 , len(s)=8 ,not same </span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #c688c1; color: #c586c0;">if</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">len</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(new_s) != </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">len</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(s):</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> digit = starting_digit</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #c688c1; color: #c586c0;">while</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">len</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(new_s) < </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">len</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(s):</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #86b173; color: #6a9955;"># digit = 9</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> digit += </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #afcaa1; color: #b5cea8;">1</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #86b173; color: #6a9955;"># digit = 10</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> new_s += </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #5ccdb6; color: #4ec9b0;">str</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(digit) </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #86b173; color: #6a9955;"># new_s = "910" (10 concatenet)</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #86b173; color: #6a9955;"># loop break when len(new_s) >= len(s)</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #86b173; color: #6a9955;"># after loop breaks new_s = "91011"</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #c688c1; color: #c586c0;">if</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> new_s == s:</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> res = </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #60a4d8; color: #569cd6;">f</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"YES </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #60a4d8; color: #569cd6;">{</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">starting_digit</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #60a4d8; color: #569cd6;">}</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cf947b; color: #ce9178;">"</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #c688c1; color: #c586c0;">break</span></div><div><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;"> </span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #d8d89f; color: #dcdcaa;">print</span><span data-darkreader-inline-color="" style="--darkreader-inline-color: #cdc8c2; color: #d4d4d4;">(res)</span></div></div><div><h4 style="text-align: left;">Method 2:</h4><ul style="text-align: left;"><li><b>Recursive Method: </b></li></ul><b> </b><br /><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 15.4px; font-weight: normal; line-height: 20px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #c586c0;">import</span><span style="color: #d4d4d4;"> re</span></div><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">separateNumbers</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">s</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">for</span><span style="color: #d4d4d4;"> i </span><span style="color: #c586c0;">in</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">range</span><span style="color: #d4d4d4;">(</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">, </span><span style="color: #dcdcaa;">len</span><span style="color: #d4d4d4;">(s)//</span><span style="color: #b5cea8;">2</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> checkComply(s[</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">:i+</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">], s[i+</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">:]):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(</span><span style="color: #569cd6;">f</span><span style="color: #ce9178;">'YES </span><span style="color: #569cd6;">{</span><span style="color: #d4d4d4;">s[</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">:i+</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">]</span><span style="color: #569cd6;">}</span><span style="color: #ce9178;">'</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">'NO'</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #6a9955;"># for checking if there are two continues number's difference is = 1</span></div><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">checkComply</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">p1</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">p2</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># next expected number = next_num</span></div><div><span style="color: #d4d4d4;"> next_num = </span><span style="color: #4ec9b0;">str</span><span style="color: #d4d4d4;">(</span><span style="color: #4ec9b0;">int</span><span style="color: #d4d4d4;">(p1) + </span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># match patter with p2</span></div><div><span style="color: #d4d4d4;"> match = re.match(next_num, p2)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> match:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># replace next_num in p2 with ""(only first occurence)</span></div><div><span style="color: #d4d4d4;"> p2_new = p2.replace(next_num, </span><span style="color: #ce9178;">''</span><span style="color: #d4d4d4;">, </span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># recursion till len(p2_new == 0)or match == None</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">len</span><span style="color: #d4d4d4;">(p2_new) == </span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">True</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> checkComply(next_num, p2_new)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">False</span></div></div></div><div><p style="text-align: left;">Note: If You've any other solution then share with us in comment box.</p><p style="text-align: left;">Thank You 😊😊 <br /><br /></p><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEhrf46xxMfIqyri0EPCXx0w2apzvkE6bhy-WxcRs61Uumc8XhZB5L4hdeA1-HKv9s0ib5yRp8jduvR9LvAC21175kLwb8E4QeL8e2j-tzNq9UVOztJVeUeK4jRGchX0BcNqkP_JCmALj_AEtv_DkyBt8wmyMirttHqKZCMp96gAsobuxHgMkPqiNNqa=s64" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" data-original-height="64" data-original-width="64" height="27" src="https://blogger.googleusercontent.com/img/a/AVvXsEhrf46xxMfIqyri0EPCXx0w2apzvkE6bhy-WxcRs61Uumc8XhZB5L4hdeA1-HKv9s0ib5yRp8jduvR9LvAC21175kLwb8E4QeL8e2j-tzNq9UVOztJVeUeK4jRGchX0BcNqkP_JCmALj_AEtv_DkyBt8wmyMirttHqKZCMp96gAsobuxHgMkPqiNNqa=w30-h27" width="30" /></a></td></tr><tr align="left"><td class="tr-caption"><a href="https://github.com/arth2002">GitHub</a></td></tr></tbody></table><p></p><p style="text-align: center;"><br /></p><p style="text-align: center;"><br /></p><p style="text-align: center;"><b><u>Other Important Post</u></b></p><ul><li><a href="https://apnacodingadda.blogspot.com/2021/11/singly-linked-list-with-python-data.html#more">Learn Singly Linked List</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/doubly-linked-list-basic-sorting-with.html#more">Learn Doubly Linked List</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/10/hangman-game.html#more">Create Hangman Game using Python</a><br /></li><li><a href="https://apnacodingadda.blogspot.com/2021/10/rock-paper-scissor-game.html#more">Create Rock Paper Scissor Game using Tkinter</a></li></ul> <br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-5858558381342856682021-11-16T12:13:00.002+05:302021-11-17T15:02:30.491+05:30Binary Search<p> <b>Binary search</b> is a efficient way to find element from <b>sorted array</b>, It works on <b>decrease and conquer</b> method.......<span></span></p><a name='more'></a><p></p><h4 style="text-align: left;">How it works?</h4><p style="text-align: left;">Binary search compares the target value to the middle element of the array, if target value is not equal to middle element it check whether middle element is greater than or less than target value, if middle element is greater than target value then target value can not be in right part of the array now once again this process repeats for left side of array until target value equals to middle element.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEgIXzBDmMbYqwBzK5aaTV9mRMXyvfylidrBMIa4zvNfBwuwSg_Aed9clW9tacyDsm3jCX7goGU-ewiGMRXEwcvV6IGCE-E8vbImh6UHPZ0LJ8wD44EqDJwgxatkON49WdkmqIYsfgpnjVkQQ11V9FYURTsYVxRAvATnL_qKILZg-8QK-INmUKcPlVqS=s617" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="253" data-original-width="617" height="207" src="https://blogger.googleusercontent.com/img/a/AVvXsEgIXzBDmMbYqwBzK5aaTV9mRMXyvfylidrBMIa4zvNfBwuwSg_Aed9clW9tacyDsm3jCX7goGU-ewiGMRXEwcvV6IGCE-E8vbImh6UHPZ0LJ8wD44EqDJwgxatkON49WdkmqIYsfgpnjVkQQ11V9FYURTsYVxRAvATnL_qKILZg-8QK-INmUKcPlVqS=w508-h207" width="508" /></a></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><h4 style="text-align: left;">Steps:</h4></div><div style="text-align: left;"><ol style="text-align: left;"><li>Compare target value = x and middle element = m </li><li>if x=m then return </li><li>else, according to m>x or m<x repeat step 1 and 2 for remaining part.</li></ol> </div><div style="text-align: left;"><h4 style="text-align: left;">Code:</h4><ul style="text-align: left;"><li><b>Recursive Method:</b></li></ul><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">binarySearchRecursive</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">targetValue</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">arr</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">min</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">max</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">min</span><span style="color: #d4d4d4;">></span><span style="color: #dcdcaa;">max</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> -</span><span style="color: #b5cea8;">1</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> mid = (</span><span style="color: #dcdcaa;">min</span><span style="color: #d4d4d4;"> + </span><span style="color: #dcdcaa;">max</span><span style="color: #d4d4d4;">)//</span><span style="color: #b5cea8;">2</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> arr[mid] > targetValue:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> binarySearchRecursive(targetValue,arr,</span><span style="color: #dcdcaa;">min</span><span style="color: #d4d4d4;">, mid-</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">elif</span><span style="color: #d4d4d4;"> arr[mid] < targetValue:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> binarySearchRecursive(targetValue,arr,mid+</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">,</span><span style="color: #dcdcaa;">max</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> mid</span></div><br /><div><span style="color: #d4d4d4;">arr = [</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">2</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">4</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">5</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">22</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">23</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">26</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">27</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">32</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">62</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">72</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">75</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">85</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">97</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">113</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">134</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">145</span><span style="color: #d4d4d4;">]</span></div><div><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(binarySearchRecursive(</span><span style="color: #b5cea8;">72</span><span style="color: #d4d4d4;">,arr,</span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">,</span><span style="color: #dcdcaa;">len</span><span style="color: #d4d4d4;">(arr))) </span><span style="color: #6a9955;"># index no: 10</span></div></div> </div><div style="text-align: left;"><ul style="text-align: left;"><li><b> Iterative Method:</b></li></ul></div><div style="margin-left: 40px; text-align: left;"><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">binarySearch</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">targetValue</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">arr</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">min</span><span style="color: #d4d4d4;"> = </span><span style="color: #b5cea8;">0</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">max</span><span style="color: #d4d4d4;"> = </span><span style="color: #dcdcaa;">len</span><span style="color: #d4d4d4;">(arr)-</span><span style="color: #b5cea8;">1</span></div><div><span style="color: #d4d4d4;"> guess = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> totalNumberOfGuesses = </span><span style="color: #b5cea8;">0</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">max</span><span style="color: #d4d4d4;">></span><span style="color: #dcdcaa;">min</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> guess = (</span><span style="color: #dcdcaa;">min</span><span style="color: #d4d4d4;"> + </span><span style="color: #dcdcaa;">max</span><span style="color: #d4d4d4;">)//</span><span style="color: #b5cea8;">2</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> arr[guess] == targetValue:</span></div><div><span style="color: #d4d4d4;"> totalNumberOfGuesses += </span><span style="color: #b5cea8;">1</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(</span><span style="color: #569cd6;">f</span><span style="color: #ce9178;">"total number of guesses : </span><span style="color: #569cd6;">{</span><span style="color: #d4d4d4;">totalNumberOfGuesses</span><span style="color: #569cd6;">}</span><span style="color: #ce9178;">"</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> guess</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">elif</span><span style="color: #d4d4d4;"> arr[guess] > targetValue:</span></div><div><span style="color: #d4d4d4;"> totalNumberOfGuesses += </span><span style="color: #b5cea8;">1</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">max</span><span style="color: #d4d4d4;"> = guess - </span><span style="color: #b5cea8;">1</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> totalNumberOfGuesses += </span><span style="color: #b5cea8;">1</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">min</span><span style="color: #d4d4d4;"> = guess + </span><span style="color: #b5cea8;">1</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> -</span><span style="color: #b5cea8;">1</span></div><br /><div><span style="color: #d4d4d4;">arr = [</span><span style="color: #b5cea8;">1</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">2</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">4</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">5</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">22</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">23</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">26</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">27</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">32</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">62</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">72</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">75</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">85</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">97</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">113</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">134</span><span style="color: #d4d4d4;">,</span><span style="color: #b5cea8;">145</span><span style="color: #d4d4d4;">]</span></div><div><span style="color: #d4d4d4;">targetValue = </span><span style="color: #b5cea8;">72</span></div><div><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(</span><span style="color: #569cd6;">f</span><span style="color: #ce9178;">"Index of </span><span style="color: #569cd6;">{</span><span style="color: #d4d4d4;">targetValue</span><span style="color: #569cd6;">}</span><span style="color: #ce9178;"> is "</span><span style="color: #d4d4d4;">,binarySearch(targetValue,arr))</span></div><div><span style="color: #6a9955;">#output:</span></div><div><span style="color: #6a9955;"># total number of guesses : 3</span></div><div><span style="color: #6a9955;"># Index of 72 is 10</span></div></div></div><div style="text-align: left;"> </div><div style="text-align: left;"><br /></div><div style="text-align: left;">Time Complexity:</div><div style="text-align: left;"><ul style="text-align: left;"><li>Best:𝛺(1)</li><li>Average:Θ(log n)</li><li>Worst:O(log n)<br /></li></ul></div><div style="text-align: left;">Space Complexity: O(1)<br /></div><div style="text-align: left;"><h4>What if we've use Linear Search Here?</h4></div><div style="text-align: left;">For, arr = [1,2,4,5,22,23,26,27,32,62,72,75,85,97,113,134,145]</div><div style="text-align: left;">Target Value = 72</div><div style="text-align: left;">Linear Search will take 11 steps</div><div style="text-align: left;">Time complexity O(n)</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Note: If you've any question or suggestion you can right down in comment section</div><div style="text-align: left;">Reference: <a href="https://en.wikipedia.org/wiki/Binary_search_algorithm">Wikipedia</a><br /></div><div style="text-align: left;"><br /></div><div style="text-align: left;">Thank You 😊😊</div><div style="text-align: left;"><br /></div><div style="text-align: center;"><span style="font-size: medium;"><u><b>Some Other useful Posts</b></u></span><br /></div><div style="text-align: left;"><ul style="text-align: left;"><li><a href="https://apnacodingadda.blogspot.com/2021/11/singly-linked-list-with-python-data.html#more">Learn Singly Linked List</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/doubly-linked-list-basic-sorting-with.html#more">Learn Doubly Linked List</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/10/hangman-game.html#more">Create Hangman Game using Python</a><br /></li><li><a href="https://apnacodingadda.blogspot.com/2021/10/rock-paper-scissor-game.html#more">Create Rock Paper Scissor Game using Tkinter</a></li></ul></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-45937556983277053612021-11-15T12:28:00.001+05:302021-11-15T12:29:00.505+05:30Doubly Linked List Basic + Sorting with Python<div><div><p> Let's move to doubly linked list , so in this post we're gonna talk about doubly linked list. it has previous , value and next in Node...<span></span></p><a name='more'></a></div><div></div><div></div><div>You can Learn about Singly Linked List <a href="https://apnacodingadda.blogspot.com/2021/11/singly-linked-list-with-python-data.html#more">Here</a></div><div> </div><div><b>Doubly Linked List:</b><br /><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/a/AVvXsEg0p87GucuTaGUvYoYQ32kElwwAr2SVws7Wf2hxzs7_M7h_4eqU7cvh2T3UcYuJA8TnMQB32qAdn092gB2XF2zZMrsZhIW6uHJiWLufH5QCaTTMClYS6K1ZM7mdxNMDimh42CFgs2ReEi31sqieTS5IHvQG3WCm_RCmOJgTRyxpTsdwuBHPsJXxi3k5=s907" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="186" data-original-width="907" height="184" src="https://blogger.googleusercontent.com/img/a/AVvXsEg0p87GucuTaGUvYoYQ32kElwwAr2SVws7Wf2hxzs7_M7h_4eqU7cvh2T3UcYuJA8TnMQB32qAdn092gB2XF2zZMrsZhIW6uHJiWLufH5QCaTTMClYS6K1ZM7mdxNMDimh42CFgs2ReEi31sqieTS5IHvQG3WCm_RCmOJgTRyxpTsdwuBHPsJXxi3k5=w640-h184" width="640" /></a></div><p>So as you can see in above image it is just like singly linked list but has one more requirement as address of previous Node.that is the reason you can go backward in doubly linked list but you can go backward in singly linked list because it don't have address of previous Node.</p><p>So let's move to code.</p><ul style="text-align: left;"><li>For Creating Node:</li></ul><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">class</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">Node</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">__init__</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">data</span><span style="color: #d4d4d4;">=</span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.data = data</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.next = </span><span style="color: #569cd6;">None</span></div></div><ul style="text-align: left;"><li>From Here Linked List and Operation on linked list:</li></ul><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">class</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">LinkedList</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">__init__</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head = </span><span style="color: #569cd6;">None</span></div></div><ul style="text-align: left;"><li>Push or insert at End:</li></ul></div><p></p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">push</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">newdata</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> NewNode = Node(newdata)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head = NewNode</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> cur = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> cur.next:</span></div><div><span style="color: #d4d4d4;"> cur = cur.next</span></div><div><span style="color: #d4d4d4;"> cur.next = NewNode</span></div><div><span style="color: #d4d4d4;"> NewNode.prev = cur</span></div></div><ul style="text-align: left;"><li>Insert at Beginning:</li></ul></div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">insertAtBeginning</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">newdata</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> NewNode = Node(newdata)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head = NewNode</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> NewNode.next = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head.prev = NewNode</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head = NewNod</span></div></div><div><ul style="text-align: left;"><li>Insert After or Insert in between:</li></ul></div><div style="margin-left: 40px; text-align: left;"><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">insertAfter</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">middle_node</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">newdata</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> NewNode = Node(newdata)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"Linked List is Empty"</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> cur = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> cur:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> cur.data == middle_node:</span></div><div><span style="color: #d4d4d4;"> temp = cur.next </span><span style="color: #6a9955;"># for cur.next.prev to set NewNode</span></div><div><span style="color: #d4d4d4;"> NewNode.next = cur.next</span></div><div><span style="color: #d4d4d4;"> NewNode.prev = cur</span></div><div><span style="color: #d4d4d4;"> cur.next = NewNode</span></div><div><span style="color: #d4d4d4;"> temp.prev = NewNode </span><span style="color: #6a9955;"># bcz cur is overwrite by NewNode</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> cur = cur.next</span></div></div></div><div><ul style="text-align: left;"><li>Remove:</li></ul></div><div style="margin-left: 40px; text-align: left;"><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">removeNode</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">data</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"Linked List is Empty.."</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> cur = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> cur.data == data:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head = cur.next</span></div><div><span style="color: #d4d4d4;"> cur = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> cur:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> cur.data == data:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (cur.next != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> cur.next.prev = cur.prev</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (cur.prev != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> cur.prev.next = cur.next</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> cur = cur.next</span></div></div></div><div><ul style="text-align: left;"><li>Print/Display Linked List:</li></ul></div><div style="margin-left: 40px; text-align: left;"><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">printLL</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"Linked List is Empty"</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> cur = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"</span><span style="color: #d7ba7d;">\n</span><span style="color: #ce9178;">Displaing Elements of Linked List: "</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> cur:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">print</span><span style="color: #d4d4d4;">(cur.data, </span><span style="color: #9cdcfe;">end</span><span style="color: #d4d4d4;">=</span><span style="color: #ce9178;">" "</span><span style="color: #d4d4d4;">)</span></div><div><span style="color: #d4d4d4;"> cur = cur.next</span></div></div></div><div><p>You can perform more operation just like we perform on singly linked list which you can check <a href="https://apnacodingadda.blogspot.com/2021/11/singly-linked-list-with-python-data.html#more">Here</a></p><p>Now let's Sort doubly linked list:</p><ul style="text-align: left;"><li>Bubble sort ( not recommended): code is same as singly linked list</li></ul></div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">bubbleSort</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> cur = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head</span></div><div><span style="color: #d4d4d4;"> idx = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head == </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> cur:</span></div><div><span style="color: #d4d4d4;"> idx = cur.next</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> idx:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> cur.data > idx.data:</span></div><div><span style="color: #d4d4d4;"> cur.data, idx.data = idx.data, cur.data</span></div><div><span style="color: #d4d4d4;"> idx = idx.next</span></div><br /><div><span style="color: #d4d4d4;"> cur = cur.next</span></div><div><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #6a9955;"># time : O(n*n)</span></div></div><span style="color: #d4d4d4;"></span></div></div> </div><div> </div><div><ul style="text-align: left;"><li>Insertion Sort:</li></ul></div><div style="margin-left: 40px; text-align: left;"><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">insertionSort</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">head_ref</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> sortedLL = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> cur = head_ref</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> cur:</span></div><div><span style="color: #d4d4d4;"> nxt = cur.next</span></div><div><span style="color: #d4d4d4;"> cur.prev = cur.next = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> sortedLL = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.sortedInsert(sortedLL,cur)</span></div><div><span style="color: #d4d4d4;"> cur = nxt</span></div><div><span style="color: #d4d4d4;"> head_ref = sortedLL</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> head_ref</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">sortedInsert</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">head_ref</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">NewNode</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> head_ref == </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> head_ref = NewNode </span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">elif</span><span style="color: #d4d4d4;"> head_ref.data >= NewNode.data:</span></div><div><span style="color: #d4d4d4;"> NewNode.next = head_ref</span></div><div><span style="color: #d4d4d4;"> NewNode.next.prev = NewNode</span></div><div><span style="color: #d4d4d4;"> head_ref = NewNode</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> cur = head_ref</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> cur.next != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">and</span><span style="color: #d4d4d4;"> cur.next.data < NewNode.data:</span></div><div><span style="color: #d4d4d4;"> cur = cur.next</span></div><div><span style="color: #d4d4d4;"> NewNode.next = cur.next</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> cur.next != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> cur.next.prev = NewNode</span></div><div><span style="color: #d4d4d4;"> cur.next = NewNode</span></div><div><span style="color: #d4d4d4;"> NewNode.prev = cur</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> head_ref</span></div></div></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><ul style="text-align: left;"><li>Merge Sort:</li></ul></div><div style="margin-left: 40px; text-align: left;"><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">sortedMerge</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">a</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">b</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> result = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> a </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> b</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> b </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> a</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> a.data <= b.data:</span></div><div><span style="color: #d4d4d4;"> result = a </span></div><div><span style="color: #d4d4d4;"> result.next = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.sortedMerge(a.next,b)</span></div><div><span style="color: #d4d4d4;"> result.next.prev = a</span></div><div><span style="color: #d4d4d4;"> result.prev = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> result = b</span></div><div><span style="color: #d4d4d4;"> result.next = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.sortedMerge(a,b.next)</span></div><div><span style="color: #d4d4d4;"> result.next.prev = b</span></div><div><span style="color: #d4d4d4;"> result.prev = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> result</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">mergeSort</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">h</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> h </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">or</span><span style="color: #d4d4d4;"> h.next </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> h</span></div><div><span style="color: #d4d4d4;"> middle = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.getMiddle(h)</span></div><div><span style="color: #d4d4d4;"> nextToMiddle = middle.next</span></div><div><span style="color: #d4d4d4;"> </span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># it divides</span></div><div><span style="color: #d4d4d4;"> middle.next = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> nextToMiddle.prev = </span><span style="color: #569cd6;">None</span></div><br /><div><span style="color: #d4d4d4;"> left = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.mergeSort(h)</span></div><div><span style="color: #d4d4d4;"> right = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.mergeSort(nextToMiddle)</span></div><br /><br /><div><span style="color: #d4d4d4;"> sortedList = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.sortedMerge(left,right)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> sortedList</span></div><br /><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">getMiddle</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">head</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> head </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> head</span></div><div><span style="color: #d4d4d4;"> slow = head</span></div><div><span style="color: #d4d4d4;"> fast = head</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> fast.next </span><span style="color: #569cd6;">and</span><span style="color: #d4d4d4;"> fast.next.next:</span></div><div><span style="color: #d4d4d4;"> slow = slow.next</span></div><div><span style="color: #d4d4d4;"> fast = fast.next.next</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> slow</span></div></div></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><ul style="text-align: left;"><li>Quick Sort:<br /></li></ul></div><div style="margin-left: 40px; text-align: left;"><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; text-align: left; white-space: pre;"><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">partition</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">start</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">end</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> pivot = start</span></div><div><span style="color: #d4d4d4;"> cur = start</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> (cur != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">and</span><span style="color: #d4d4d4;"> cur != end):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (cur.data < end.data):</span></div><div><span style="color: #d4d4d4;"> pivot = start</span></div><div><span style="color: #d4d4d4;"> start.data, cur.data = cur.data,start.data</span></div><div><span style="color: #d4d4d4;"> start = start.next</span></div><div><span style="color: #d4d4d4;"> cur = cur.next</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> cur </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> cur = start</span></div><div><span style="color: #d4d4d4;"> start.data,end.data = end.data, start.data</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> pivot</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">quickSort</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">start</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">end</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> start == end:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> pivot = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.partition(start, end)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> pivot != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.quickSort(pivot.next, end)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.quickSort(start, pivot)</span></div><div><span style="color: #d4d4d4;"> </span></div></div></div><div style="text-align: left;"><br /></div><div style="text-align: left;"><div style="text-align: left;">Note: If there is some indentation problem while pasting code so take a look at <span> </span><span> <span> </span></span>that problem , and If you have any better implementation then you can <span> </span><span> </span> comment. </div><div style="text-align: left;"><span> </span><span> </span>Open for suggestion...</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Thank You 😊😊<br /></div><div style="text-align: left;"> </div><div style="text-align: left;">Sorting Algorithms for Singly Linked List:</div><ul style="text-align: left;"><li><a href="https://apnacodingadda.blogspot.com/2021/11/bubble-sort-for-singly-linked-list.html#more" target="_blank">Bubble sort on Singly Linked List</a> </li><li><a href="https://apnacodingadda.blogspot.com/2021/11/insertion-sort-for-singly-linked-list.html#more" target="_blank">Insertion sort on Singly Linked List</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/merge-sort-for-singly-linked-list-using.html#more" target="_blank">Merge Sort for Singly Linked List </a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/quick-sort-for-singly-linked-list-using.html#more" target="_blank">Quick Sort for Singly Linked list </a></li></ul></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-20996469056844949692021-11-14T00:22:00.006+05:302021-11-14T00:22:55.970+05:30Quick Sort for Singly Linked List using Python<p>Quick Sort: It's basically works on divide and conquer method, choose pivot as first node,last ,middle and make partition and swap values.<br /></p><p><span></span></p><a name='more'></a> <p></p><p>First Check out <a href="https://apnacodingadda.blogspot.com/2021/11/singly-linked-list-with-python-data.html#more" target="_blank">Basic Operation on Singly Linked list.</a></p><p>Code:</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">class</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">Node</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">__init__</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">data</span><span style="color: #d4d4d4;">=</span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.data = data</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.next = </span><span style="color: #569cd6;">None</span></div><br /><div><span style="color: #569cd6;">class</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">LinkedList</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">__init__</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #ce9178;">""" Quick Sort"""</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># it's basically works on divide on conquer method</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># in this function we'll swap values and return pivot</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">partition</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">start</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">end</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> pivot = start </span><span style="color: #6a9955;"># taking start(first node) as pivot</span></div><div><span style="color: #d4d4d4;"> cur = start</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> (cur != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">and</span><span style="color: #d4d4d4;"> cur != end):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (cur.data < end.data):</span></div><div><span style="color: #d4d4d4;"> pivot = start</span></div><div><span style="color: #d4d4d4;"> start.data, cur.data = cur.data,start.data</span></div><div><span style="color: #d4d4d4;"> start = start.next</span></div><div><span style="color: #d4d4d4;"> cur = cur.next</span></div><div><span style="color: #d4d4d4;"> start.data,end.data = end.data, start.data</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> pivot</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">quickSort</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">start</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">end</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;">#base case</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> start == end:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;">#setting up pivot</span></div><div><span style="color: #d4d4d4;"> pivot = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.partition(start, end)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># recursion</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (pivot != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">and</span><span style="color: #d4d4d4;"> pivot.next != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.quickSort(pivot.next, end)</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> (pivot != </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">and</span><span style="color: #d4d4d4;"> start != pivot):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.quickSort(start, pivot)</span></div></div><p> </p><p>Time Complexity:</p><ul style="text-align: left;"><li>Best: 𝛺(n*log n)</li><li>Average:Θ(n*log n)</li><li>Worst: O(n*n)</li></ul><p>Tip: If we take take pivot wisely(random pivot would be great choice) then worst case can reduced to O(n*log n)<span></span> <br /></p><p> Space Complexity: O(1)</p><p>Note: if You have any suggestion put in comments.</p><p>Thank You 😊😊</p><p>Other Sorting Algorithms:</p><ul style="text-align: left;"><li><a href="https://apnacodingadda.blogspot.com/2021/11/bubble-sort-for-singly-linked-list.html#more" target="_blank">Bubble Sort for Singly Linked list</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/insertion-sort-for-singly-linked-list.html#more" target="_blank">Insertion Sort for Singly Linked list</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/merge-sort-for-singly-linked-list-using.html#more" target="_blank">Merge Sort for Singly Linked list </a><br /></li></ul><p> </p><p> </p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7775509567086260992.post-85396042587645952282021-11-13T17:55:00.002+05:302021-11-14T00:23:53.710+05:30Merge sort for Singly Linked List using Python<div><p> Merge Sort , so merge sort divide linked list into smaller part and sort and merge those parts in one linked list, let's see how?<span></span></p><a name='more'></a><p></p><p> First Check out <a href="https://apnacodingadda.blogspot.com/2021/11/singly-linked-list-with-python-data.html#more" target="_blank">Basic Operation on Singly Linked list. </a></p><p>Code:</p><div style="background-color: #1e1e1e; color: #d4d4d4; font-family: "Droid Sans Mono", "monospace", monospace, "Droid Sans Fallback"; font-size: 14px; font-weight: normal; line-height: 19px; margin-left: 40px; text-align: left; white-space: pre;"><div><span style="color: #569cd6;">class</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">Node</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">__init__</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">data</span><span style="color: #d4d4d4;">=</span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.data = data</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.next = </span><span style="color: #569cd6;">None</span></div><br /><div><span style="color: #569cd6;">class</span><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">LinkedList</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">__init__</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.head = </span><span style="color: #569cd6;">None</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #ce9178;">""" Merge Sort"""</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># this funtion sort divided linked list and merge </span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># them into one linked list</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">sortedMerge</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">a</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">b</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> result = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> a </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> b</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> b </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> a</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> a.data <= b.data:</span></div><div><span style="color: #d4d4d4;"> result = a </span></div><div><span style="color: #d4d4d4;"> result.next = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.sortedMerge(a.next,b)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">else</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> result = b</span></div><div><span style="color: #d4d4d4;"> result.next = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.sortedMerge(a,b.next)</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> result</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">mergeSort</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">h</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;">#base case</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> h </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">or</span><span style="color: #d4d4d4;"> h.next </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> h</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;">#find middle</span></div><div><span style="color: #d4d4d4;"> middle = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.getMiddle(h)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># take middle.next in nextToMiddle for dividing </span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># linked list in two part</span></div><div><span style="color: #d4d4d4;"> nextToMiddle = middle.next</span></div><div><span style="color: #d4d4d4;"> </span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># it divides</span></div><div><span style="color: #d4d4d4;"> middle.next = </span><span style="color: #569cd6;">None</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># recursion</span></div><div><span style="color: #d4d4d4;"> left = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.mergeSort(h)</span></div><div><span style="color: #d4d4d4;"> right = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.mergeSort(nextToMiddle)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;">#it stops when linked list won't divided</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;">#now sort and merge</span></div><div><span style="color: #d4d4d4;"> sortedList = </span><span style="color: #569cd6;">self</span><span style="color: #d4d4d4;">.sortedMerge(left,right)</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> sortedList</span></div><br /><div><span style="color: #d4d4d4;"> </span><span style="color: #6a9955;"># it will find middle of linked list</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">def</span><span style="color: #d4d4d4;"> </span><span style="color: #dcdcaa;">getMiddle</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">self</span><span style="color: #d4d4d4;">,</span><span style="color: #9cdcfe;">head</span><span style="color: #d4d4d4;">):</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">if</span><span style="color: #d4d4d4;"> head </span><span style="color: #569cd6;">is</span><span style="color: #d4d4d4;"> </span><span style="color: #569cd6;">None</span><span style="color: #d4d4d4;">:</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> head</span></div><div><span style="color: #d4d4d4;"> slow = head</span></div><div><span style="color: #d4d4d4;"> fast = head</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">while</span><span style="color: #d4d4d4;"> fast.next </span><span style="color: #569cd6;">and</span><span style="color: #d4d4d4;"> fast.next.next:</span></div><div><span style="color: #d4d4d4;"> slow = slow.next</span></div><div><span style="color: #d4d4d4;"> fast = fast.next.next</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #c586c0;">return</span><span style="color: #d4d4d4;"> slow</span></div></div><p> Time Complexity:</p><ul style="text-align: left;"><li>Best: 𝛺(n*log n)</li><li>Average:Θ(n*log n)</li><li>Worst: O(n*log n)</li></ul> Space Complexity: O(log n)</div><div style="text-align: left;"><p><span> </span>Note: if You have any suggestion put in comments.</p><p>Thank You 😊😊</p><p>Other Sorting Algorithms:</p><ul style="text-align: left;"><li><a href="https://apnacodingadda.blogspot.com/2021/11/bubble-sort-for-singly-linked-list.html#more" target="_blank">Bubble Sort for Singly Linked list</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/insertion-sort-for-singly-linked-list.html#more" target="_blank">Insertion Sort for Singly Linked list</a></li><li><a href="https://apnacodingadda.blogspot.com/2021/11/quick-sort-for-singly-linked-list-using.html#more" target="_blank">Quick Sort for Singly Linked list </a><br /></li></ul></div><div style="text-align: left;"> <br /></div><br /><div><p><br /></p></div>Unknownnoreply@blogger.com0