<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4314590246127372628</id><updated>2024-11-06T08:38:12.964+05:30</updated><category term="Round G 2021 kick start"/><category term="java dynamic problem"/><category term="13 New Unknown Facts About Internet one by one."/><category term="Boring Numbers Problem"/><category term="Calculate the total amount for purchased items from the menu using Html and java script"/><category term="Combination Lock"/><category term="Django framework password generator"/><category term="Doctor appointment booking system with code"/><category term="Dogs and Cats Problem"/><category term="Find duplicate elements in an array including negative numbers"/><category term="Five real life lesson about internet"/><category term="Fully functioning top navigation bar using html"/><category term="Getting Multiple Integer Inputs in a single line."/><category term="Google Kick Start Round A 2020 Allocation in Java"/><category term="Google Kick Start Round A 2021 L shaped plots problem solved using Python"/><category term="Google Kick Start Round H 2020"/><category term="Google Kick Start Round H 2021 problem"/><category term="Google kick start Round A 2020 Bundling pip"/><category term="Google kick start Round E 2020 Longest Arithmetic problem solved using java"/><category term="Google kick start round A 2021 K-Goodness string problem"/><category term="Image processing"/><category term="Internet Expectation vs Reality"/><category term="Java Code Kick Start Friends Problem"/><category term="Java digital image processing"/><category term="Kick_Start Problem. Kick Start 2020 Round G Problems Solved."/><category term="Maximum Coins"/><category term="Merge Cards Problem 2020"/><category term="Responsive marksheet design sample in html code"/><category term="Round B Google kickstart Checkpoints problem"/><category term="Round C 2020 google kickstart countdown problem solved"/><category term="Round D 2020  google kickstart record breaker task problem solved using java"/><category term="Round G 2020 Google Kick Start"/><category term="Round H 2020 Kick Start Friends Problem"/><category term="Round H 2020 Kick Start Rugby Problem"/><category term="Round H google kickstart retype problem"/><category term="Round f 2020 google kickstart ATM queue prblem"/><category term="Running python code in cloud platform called Google Colaboratory."/><category term="Shuffled Anagrams problem solved in java"/><category term="Solved Competitive Problem in Java."/><category term="Staying Hydrated Problem"/><category term="Tracing matrix program"/><category term="Trash Bins problem round F 2021 Kick Start"/><category term="bit-plane slicing."/><category term="black and white"/><category term="blink post"/><category term="changing background color"/><category term="css and js."/><category term="dip example"/><category term="find the given number is prime or not"/><category term="google kick start round a plates problem"/><category term="gray"/><category term="hiding post and Request and Response object using Java Script"/><category term="hit counter and changing text colour using java script."/><category term="how to use for loop and if condition in a html template django"/><category term="html code for marksheet"/><category term="java hashtable find duplicate element"/><category term="java script and html."/><category term="java to find prime numbers between the given range"/><category term="large prime and small composite"/><category term="mark attendance of university student in html"/><category term="mark sheet using html and css"/><category term="negative"/><category term="prime numbers between 1 to 100"/><category term="print a character of string in new line with and without using looping statement in java"/><category term="python django framework from scratch"/><category term="read"/><category term="round b 2020 google kickstart bus route problem"/><category term="scale using java paint"/><category term="small questions and answers to know about css"/><category term="student marksheet html code"/><category term="write"/><title type='text'>Know About </title><subtitle type='html'>Blog To Know About Internet.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>44</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-7331366793709451509</id><published>2022-02-19T21:02:00.002+05:30</published><updated>2022-02-19T21:21:23.317+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="mark attendance of university student in html"/><title type='text'>Mark attendance of university student in html.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;

&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
  
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;

&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
Designing a responsive student attendance code with html and css which allows us to maintain the alignment of the code without breaking into parts depending on different screen sizes.
&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
The code is going to contain a responsive &lt;a href=&quot;https://www.knowsabouts.in/2021/08/full-fledged-responsive-top-navigation.html&quot;&gt;top navigation bar &lt;/a&gt;along with the student attendance code. Working with percentage or view Width and Height instead of going with pixels or centimetres or any other lengths will give us a responsive student attendance design. Let&#39;s assume the marksheet table has to be on the centre of the page with 50 percent of the screen&#39;s, if it&#39;s a fixed screen then we can go with fixed value for this we will go with 50% this will automatically assign the table size to 50 percent of the screen&#39;s size.  
&lt;br&gt;&lt;br&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhf0Ju1bUTt8eZN9Yi5wV4whWQcc35_flZzpU-3f716g8hgrtXpgLkO-aeYlafImhEWn3dmlC4UbgqW9S0ENvX58rpcd7pcYYNeihj5HW9Ojup7P8QvRfqRJOo3TUrMZtELNQwvWKLP8JuYXhjEmFISzbf1wC7ju-5bd5TmoNB4xqfw26LovkYV10HWbg=s511&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;400&quot; data-original-height=&quot;511&quot; data-original-width=&quot;478&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhf0Ju1bUTt8eZN9Yi5wV4whWQcc35_flZzpU-3f716g8hgrtXpgLkO-aeYlafImhEWn3dmlC4UbgqW9S0ENvX58rpcd7pcYYNeihj5HW9Ojup7P8QvRfqRJOo3TUrMZtELNQwvWKLP8JuYXhjEmFISzbf1wC7ju-5bd5TmoNB4xqfw26LovkYV10HWbg=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;  
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
For a professor to mark attendance to a particular class by choosing class, batch year(moreover classes can be split using sections), assigned subject, date and atlast class timing. Here comes the backend process once the request is triggered, first of all you have to check whether the requested class is assigned for this professor or not. If not just show the error message and tell the user to select the appropriate class. If the class is assigned for this professor and in the next step check whether the batch year is correctly selected or not and then the selected subject is assigned or not atlast the date and time has to be verified whether the date(days) and time is matched with class, batch year and subject in the timetable. Once the verification process is over you have to show the list of students in that class with required student details with an option to mark whether the student is present or absent. Here we are going to add one more field default present or absent option to make professors work easier. 
&lt;br/&gt;&lt;br/&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:120vh;&quot;&gt;
  
    &lt;html&gt;
    &lt;head&gt;

      &lt;style&gt;
      *{
        color:red;
        font-weight: bold;
        background: url(https://i.pinimg.com/originals/44/6e/3b/446e3b79395a287ca32f7977dd83b290.jpg);
      }
      label, #messages{
        color:white;
      }
      ::-webkit-calendar-picker-indicator {
        filter: invert(1);
      }
    &lt;/style&gt;
      &lt;/head&gt;
    &lt;body&gt;

    &lt;h3 id=&quot;head&quot;&gt;Loged in as Professor&lt;span id=&quot;u_name&quot;&gt; Hello, &lt;!--professor name--&gt;&lt;/span&gt;&lt;/h3&gt;

    &lt;div style=&quot;display: flex;&quot;&gt;
      &lt;form action=&quot;&quot; method=&quot;post&quot; id=&quot;form&quot;&gt;

        &lt;h3 id=&quot;form_head&quot;&gt;Mark attendance&lt;/h3&gt;
        &lt;table border=&quot;5&quot; &gt;
        &lt;!--show class details here to select--&gt;
        &lt;/table&gt;
          &lt;div class=&quot;btn-block&quot;&gt;
            &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;
          &lt;/div&gt;
      &lt;/form&gt;
    &lt;/div&gt;

    &lt;/body&gt;
    &lt;/html&gt;
&lt;/textarea&gt;   
&lt;br&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj_QPIgOdz3ZHZ0JXI6_P7bCDMmeOCQR8EFPu4WO9ysFD8JNmUZgUc4zl21eL0P5jz49lYGqAciDZjsYp7hx_rDuF3YDS49bZqb2JpqnWd-Nr3yJJRXKGpJH4gIJc5az5OFBXxeEVlSLZcmN_kLTcwVrJG1e42bImLYrUAB7dnewlMXSRipfZiYYWIBIQ=s645&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;368&quot; data-original-width=&quot;645&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj_QPIgOdz3ZHZ0JXI6_P7bCDMmeOCQR8EFPu4WO9ysFD8JNmUZgUc4zl21eL0P5jz49lYGqAciDZjsYp7hx_rDuF3YDS49bZqb2JpqnWd-Nr3yJJRXKGpJH4gIJc5az5OFBXxeEVlSLZcmN_kLTcwVrJG1e42bImLYrUAB7dnewlMXSRipfZiYYWIBIQ=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;  
  

&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
If a student is present you have to show it in a colour and if a student is not present it has to be in another colour which makes it easier. Each time a professor marks present or absent for a student, the number of absentees and the number of attendees will be changed, that way the professor can know how many students were absent or present.
&lt;br&gt;&lt;br&gt;
  
&lt;textarea  wrap=&quot;off&quot; style=&quot;height:160vh;&quot;&gt;
  
      &lt;html&gt;
      &lt;head&gt;
        &lt;style&gt;
          *{
            background: black;
          }
          table{
            margin-left: auto;
            margin-right: auto;
          }
          td{
            color:rgb(226, 10, 10);
          }
      &lt;/style&gt;

      &lt;/head&gt;
      &lt;body&gt;

      &lt;h3 id=&quot;head&quot;&gt;Loged in as Professor&lt;span id=&quot;u_name&quot;&gt; Hello, &lt;!--professor name--&gt;&lt;/span&gt;&lt;/h3&gt;

      &lt;table border=&quot;2&quot;&gt;
          &lt;thead&gt;
            &lt;tr&gt;
              &lt;th&gt;Department (class)&lt;/th&gt;
              &lt;th&gt;Batch&lt;/th&gt;
              &lt;th&gt;subject&lt;/th&gt;
              &lt;th&gt;Date&lt;/th&gt;
              &lt;th&gt;Time&lt;/th&gt;
              &lt;th&gt;Number of Attendees&lt;/th&gt;
              &lt;th&gt;Number of Absentees&lt;/th&gt;
            &lt;/tr&gt;
          &lt;/thead&gt;

          &lt;tr&gt;
            &lt;td&gt;&lt;!--department--&gt;&lt;/td&gt;
            &lt;td&gt;&lt;!--batch year--&gt;&lt;/td&gt;
            &lt;td&gt;&lt;!--subject--&gt;&lt;/td&gt;
            &lt;td&gt;&lt;!--date--&gt;&lt;/td&gt;
            &lt;td&gt;&lt;!--time--&gt;&lt;/td&gt;
            &lt;td&gt;&lt;!--number of student&#39;s prensent--&gt;&lt;/td&gt;
            &lt;td&gt;&lt;!--number of studnet&#39;s absent--&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;br&gt;&lt;br&gt;

      &lt;div style=&quot;display: flex;&quot;&gt;
      &lt;br&gt;&lt;br&gt;

      &lt;form action=&quot;&quot; method=&quot;post&quot; id=&quot;&quot;&gt;

        &lt;table border=&quot;3&quot;&gt;
          &lt;thead&gt;
            &lt;tr&gt;
              &lt;th&gt;Serial Number&lt;/th&gt;
              &lt;th&gt;Student Name&lt;/th&gt;
              &lt;th&gt;Student Register Number&lt;/th&gt;
              &lt;th&gt;Attendance&lt;/th&gt;
            &lt;/tr&gt;
          &lt;/thead&gt;

          &lt;tr&gt;
                                    &lt;td&gt;&lt;!--serial number--&gt;&lt;/td&gt;
                                    &lt;!--if student is present show this--&gt;
                                    &lt;td style=&quot;background: aqua;&quot;&gt;&lt;!--student name--&gt;&lt;/td&gt;
                                    &lt;td style=&quot;background: aqua;&quot;&gt;&lt;!--student register_number--&gt;&lt;/td&gt;
                                    &lt;!--if studnet is absent show this one--&gt;
                                    &lt;td style=&quot;background: pink;&quot;&gt;&lt;!--studnet name--&gt;&lt;/td&gt;
                                    &lt;td style=&quot;background: pink;&quot;&gt;&lt;!--studnet register number--&gt;&lt;/td&gt;

                   &lt;td style=&quot;background: grey;&quot;&gt;&lt;button type=&quot;submit&quot; name=&quot;present&quot; style=&quot;background:green&quot; value=&quot;register_number&quot;&gt;Present&lt;/button&gt;
                   &lt;button type=&quot;submit&quot; name=&quot;absent&quot; style=&quot;background:red&quot; value=&quot;{{s.register_number}}&quot;&gt;Absent&lt;/button&gt;&lt;/td&gt;          
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;/form&gt;
      &lt;/div&gt;

      &lt;/body&gt;
      &lt;/html&gt;
&lt;/textarea&gt;   
&lt;br&gt;  
           
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiqGCnS_e7pXfB6IEjC5QW2Gsy52tuRyKzYRJRvgQciJo6uGowo9mT4pzP9fgU-KgyVCjL82YsSlfXANeX4ZlZJtNrI2I1NZHOiY5RP2X6UNfAdbyOKPXfa4QbBUooczpPEwALn6CbTFOg9tAVvSp0qZxca-XaikIdTYzvHNEGK6G4g4fUbCyANLXbNcw=s649&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;396&quot; data-original-width=&quot;649&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiqGCnS_e7pXfB6IEjC5QW2Gsy52tuRyKzYRJRvgQciJo6uGowo9mT4pzP9fgU-KgyVCjL82YsSlfXANeX4ZlZJtNrI2I1NZHOiY5RP2X6UNfAdbyOKPXfa4QbBUooczpPEwALn6CbTFOg9tAVvSp0qZxca-XaikIdTYzvHNEGK6G4g4fUbCyANLXbNcw=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgAlgz7dKviz6YfU9f6TKGVaj4QupLsVkm6PeS2dgrDMoKwLoXes1kCGfQf1SJkpiqxNuw_2iromWzUFm9179c0xwz0iWJTQjY18IzwZB3ipJx6Rlr_0-ZwWbOaz8_GQYa7hExSuj78ijlOems4tg1-sbpIEJPaK1JJvKcL8UqZpE5zqI-cyK_qge3L3Q=s648&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;596&quot; data-original-width=&quot;648&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgAlgz7dKviz6YfU9f6TKGVaj4QupLsVkm6PeS2dgrDMoKwLoXes1kCGfQf1SJkpiqxNuw_2iromWzUFm9179c0xwz0iWJTQjY18IzwZB3ipJx6Rlr_0-ZwWbOaz8_GQYa7hExSuj78ijlOems4tg1-sbpIEJPaK1JJvKcL8UqZpE5zqI-cyK_qge3L3Q=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
Firstly, filter attendance table with student register number, next split the filtered record by subject name and then count the number of present and absent in that class and show it to the user with the list.
&lt;br/&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:160vh;&quot;&gt;
      
      &lt;html&gt;
      &lt;head&gt;
        &lt;style&gt;
          *{
            background: black;
          }
          table{
            margin-left: auto;
            margin-right: auto;
          }
          td{
            color:rgb(226, 10, 10);
          }
      &lt;/style&gt;

      &lt;/head&gt;
      &lt;body&gt;

      &lt;h3 id=&quot;head&quot;&gt;Loged in as Student&lt;span id=&quot;u_name&quot;&gt; Hello, &lt;!--professor name--&gt;&lt;/span&gt;&lt;/h3&gt;

      &lt;table border=&quot;2&quot;&gt;
          &lt;thead&gt;
            &lt;tr&gt;
              &lt;th&gt;Student Name&lt;/th&gt;
              &lt;th&gt;Student Register Number&lt;/th&gt;  
              &lt;th&gt;Department (class)&lt;/th&gt;
              &lt;th&gt;Batch&lt;/th&gt;
            &lt;/tr&gt;
          &lt;/thead&gt;

          &lt;tr&gt;
            &lt;td&gt;&lt;!--student name--&gt;&lt;/td&gt;
            &lt;td&gt;&lt;!--student register number--&gt;&lt;/td&gt;
            &lt;td&gt;&lt;!--department--&gt;&lt;/td&gt;
            &lt;td&gt;&lt;!--batch year--&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;br&gt;&lt;br&gt;

      &lt;h3 id=&quot;head&quot;&gt;&lt;!--subject name--&gt;&lt;/h3&gt;
      &lt;table border=&quot;3&quot;&gt;
        &lt;thead&gt;
          &lt;tr&gt;
            &lt;th&gt;Total Number of Classes&lt;/th&gt;
            &lt;th&gt;Number of Classes Present&lt;/th&gt;
            &lt;th&gt;Number of Classes Absent&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;!--total number of classes--&gt;&lt;/td&gt;
          &lt;td&gt;&lt;!--number of classes present--&gt;&lt;/td&gt;
          &lt;td&gt;&lt;!--number of classes absent--&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;br&gt;
      &lt;table border=&quot;3&quot;&gt;
          &lt;thead&gt;
            &lt;tr&gt;
              &lt;th&gt;Subject&lt;/th&gt;
              &lt;th&gt;Date&lt;/th&gt;
              &lt;th&gt;Time&lt;/th&gt;
              &lt;th&gt;Attendance&lt;/th&gt;
            &lt;/tr&gt;
          &lt;/thead&gt;

          &lt;tr&gt;
              &lt;!--if student present in this class--&gt;
              &lt;td style=&quot;background: cyan;&quot;&gt;&lt;!--class date--&gt;&lt;/td&gt;
              &lt;td style=&quot;background: cyan;&quot;&gt;&lt;!--class timing--&gt;&lt;/td&gt;
              &lt;td style=&quot;background: cyan;&quot;&gt;&lt;!--subject--&gt;&lt;/td&gt;
              &lt;td style=&quot;background: cyan;&quot;&gt;Present&lt;/td&gt;

              &lt;!--if student absent in this class--&gt;
              &lt;td style=&quot;background: pink;&quot;&gt;&lt;!--class date--&gt;&lt;/td&gt;
              &lt;td style=&quot;background: pink;&quot;&gt;&lt;!--class timing--&gt;&lt;/td&gt;
              &lt;td style=&quot;background: pink;&quot;&gt;&lt;!--subject--&gt;&lt;/td&gt;
              &lt;td style=&quot;background: pink;&quot;&gt;Absent&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;br&gt;&lt;br&gt;

      &lt;/body&gt;
      &lt;/html&gt;
&lt;/textarea&gt;

&lt;br&gt;&lt;br&gt;  
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/7331366793709451509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2022/02/mark-attendance-of-university-student.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/7331366793709451509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/7331366793709451509'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2022/02/mark-attendance-of-university-student.html' title='Mark attendance of university student in html.'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhf0Ju1bUTt8eZN9Yi5wV4whWQcc35_flZzpU-3f716g8hgrtXpgLkO-aeYlafImhEWn3dmlC4UbgqW9S0ENvX58rpcd7pcYYNeihj5HW9Ojup7P8QvRfqRJOo3TUrMZtELNQwvWKLP8JuYXhjEmFISzbf1wC7ju-5bd5TmoNB4xqfw26LovkYV10HWbg=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-7430813763827660279</id><published>2022-01-11T17:18:00.009+05:30</published><updated>2022-02-28T14:13:14.948+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Doctor appointment booking system with code"/><title type='text'>Doctor Appointment Booking System with source code</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;/&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
  
&lt;script async=&quot;&quot; crossorigin=&quot;anonymous&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-8963593429134655&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;3245859952&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;  
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br /&gt;  
  
&lt;span id=&quot;para&quot;&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEio0B204V3zZ528SafbFnHuVrKEZR5Af8Fzrhbicjh26eiNqzDPF5QVRkS2lZ8FHDHZNUbzvOt6zfNOVnT0cg7vF27PP5onatc5yM8ccxLnjqEYjNmuRt9sKR87nDLybtD6h2aMjK3EtGDQcDgNqLUyRMlBdnK6aHycAJnh0iuHU_0Ji8VLi3ps7aotVg=s1361&quot; style=&quot;display: block; padding: 1em 0; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;623&quot; data-original-width=&quot;1361&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEio0B204V3zZ528SafbFnHuVrKEZR5Af8Fzrhbicjh26eiNqzDPF5QVRkS2lZ8FHDHZNUbzvOt6zfNOVnT0cg7vF27PP5onatc5yM8ccxLnjqEYjNmuRt9sKR87nDLybtD6h2aMjK3EtGDQcDgNqLUyRMlBdnK6aHycAJnh0iuHU_0Ji8VLi3ps7aotVg=s600&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;a id=&quot;head&quot;&gt;Requirements&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
Python (latest version preferable)&lt;br&gt;
Django (latest version preferable)&lt;br&gt;
IDE (Visual Studio Code preferable)&lt;br&gt;  
and a browser is needed to run the project.&lt;br&gt;
&lt;a href=&quot;https://www.knowsabouts.in/2021/11/python-django-random-password-generator.html&quot;&gt;If you don&#39;t know how to create a Django local virtual environment please click the link to know about.&lt;/a&gt;  
&lt;br /&gt;&lt;br&gt;  
  
&lt;a id=&quot;head&quot;&gt;Abstract&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
Doctor Appointment Booking system using Django framework in python, along with Html and Css. Django not only makes our work easy which also provides the end user a user-friendly visualisation of what is happening.
&lt;br /&gt;
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br /&gt;
The beauty of Django is that it provides an in-built database. So there is no need to create a database connection that has to be created in this project.  
&lt;br /&gt;
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br /&gt;
One of Django&#39;s features is that we can split users into groups. Here we are going to split user’s into three groups called Admin, Doctor and Patient group. For a new user patient group is going to be a default one, if the user belongs to a doctor or admin administrative person has to put the user in that specified group.  
&lt;br /&gt;&lt;br /&gt; 
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiqfmEfdQOTl5N1X-1k0nmUw5gcTGaOLjSJW7o3OUtJ7sRUih8i3oczx59L_9WqjmAuGyZjvJqpsNzBxMZV3_rmxI5DPinE9ByWPGagYO_jqzd95LFdeuKuG-JbvLx1joP7HBzfVolIsyHLlRJabIT1au0dsaIP1ew8O2l0xgBYO7bJ8bgVEncKu1UEiw=s810&quot; style=&quot;display: block; padding: 1em 0; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;604&quot; data-original-width=&quot;810&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiqfmEfdQOTl5N1X-1k0nmUw5gcTGaOLjSJW7o3OUtJ7sRUih8i3oczx59L_9WqjmAuGyZjvJqpsNzBxMZV3_rmxI5DPinE9ByWPGagYO_jqzd95LFdeuKuG-JbvLx1joP7HBzfVolIsyHLlRJabIT1au0dsaIP1ew8O2l0xgBYO7bJ8bgVEncKu1UEiw=s320&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br /&gt;
Django also provides a default user registration and authentication system within it. With the help of the group&#39;s, user&#39;s will be redirected to their respective pages. For Example If the user belongs to a patient group that user will be redirected to the Patient Registration Page.
&lt;br /&gt;&lt;br /&gt;  

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgxIpGVkAKzhgPat4_XrWJSsPS3_IVjRURJgA4Q1ehd9nWI9u7xrXlLah15MQl5FkZql0Da8fao2IK9LRn5znwN-0DeSW47ZzY6l9ShiIOC9e94y3EzxlzIq-DJrXmryLzZPhHdec6lh4ynk1VwhCLq69FyrZCRQiSOWoAE5oorygF_0HNQW_UtUgfhrw=s383&quot; style=&quot;display: block; padding: 1em 0; text-align: center;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;383&quot; data-original-width=&quot;378&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgxIpGVkAKzhgPat4_XrWJSsPS3_IVjRURJgA4Q1ehd9nWI9u7xrXlLah15MQl5FkZql0Da8fao2IK9LRn5znwN-0DeSW47ZzY6l9ShiIOC9e94y3EzxlzIq-DJrXmryLzZPhHdec6lh4ynk1VwhCLq69FyrZCRQiSOWoAE5oorygF_0HNQW_UtUgfhrw=s320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
  
&lt;a id=&quot;head&quot;&gt;Feature Of Work&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
While filling the patient&#39;s registration form the user has to choose the appointment date and a doctor from the available doctor&#39;s drop down and the details will be shown to the particular doctor and the doctor makes the decision whether to schedule or reject the requested appointment and an email will sent to the patient&#39;s Email ID to know about the appointment details.
&lt;br /&gt;&lt;br /&gt;

  
&lt;a id=&quot;head&quot;&gt;Procedure&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;          
&lt;a id=&quot;head&quot;&gt;Step 1:&lt;/a&gt;
Run the Django project and open the URL generated in IDE’s terminal in a browser. Now, in the home page we get to view the register and login options. 
&lt;br /&gt; 
&lt;a id=&quot;head&quot;&gt;Step 2:&lt;/a&gt;
Once a user account is changed to a doctor&#39;s group that doctor has to fill the Doctor’s Registration Form.
&lt;br /&gt; 
&lt;a id=&quot;head&quot;&gt;Step 3:&lt;/a&gt;  
While filling the patient&#39;s registration form the user has to choose the appointment date and a doctor from the available doctor&#39;s drop down. 
&lt;br /&gt;
&lt;a id=&quot;head&quot;&gt;Step 4:&lt;/a&gt;  
In the doctor module the doctor has to approve or reject the requested patient&#39;s appointment.  
&lt;br /&gt;
&lt;a id=&quot;head&quot;&gt;Step 5:&lt;/a&gt;  
Once the appointment has been confirmed or rejected a mail will be generated and sent to the patient&#39;s mail-id. 
&lt;br /&gt;&lt;br /&gt; 
  
&lt;a id=&quot;head&quot;&gt;Problem Statement&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;  
The only impediment about this project is one patient can request as many appointment&#39;s as he/she wants and there is no restriction for a patient user to wait until the requested result arrives he/she can be request appointment&#39;s to multiple doctor&#39;s at the same time. 
&lt;br /&gt;&lt;br /&gt;   
 
&lt;a id=&quot;head&quot;&gt;views.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;   
&lt;textarea style=&quot;height: 150vh;&quot; wrap=&quot;off&quot;&gt;
  
      from django.http.response import HttpResponse, HttpResponseRedirect
      from django.shortcuts import get_object_or_404, render, redirect
      from. forms import CreateUserForm, patient_info, doctor_infos
      from django.contrib import messages
      from django.contrib.auth import get_user
      from .import models
      from django.contrib.auth.models import Group
      from django.contrib.auth import authenticate, login, logout
      from django.contrib.auth.decorators import login_required
      from. decorators import unauthenticated_user
      from django.core.exceptions import ValidationError
      from django.contrib.auth.models import User
      from django.core.mail import EmailMultiAlternatives
      from datetime import date
      import re

      def home(request):
          return render(request, &#39;GFG.html&#39;)

      @unauthenticated_user
      def register(request):  
              # default user login form 
              form =CreateUserForm()
              if request.method == &#39;POST&#39;:
                  form = CreateUserForm(request.POST)
                  if form.is_valid():
                      usernamedisplay = form.cleaned_data.get(&#39;username&#39;)
                      email = request.POST.get(&#39;email&#39;)
                      if User.objects.filter(email=email).exists():
                          messages.error(request,&#39;Please provide unique email&#39;)
                          context = {&#39;form&#39;:form}
                          return render(request, &#39;register.html&#39;, context)
                      #setting user to assign group by default
                      user = form.save()
                      group = Group.objects.get(name =&#39;Patient&#39;)
                      user.groups.add(group)

                      messages.success(request,&#39;Successfully created account for {}. Login to Continue...&#39;.format(usernamedisplay))
                  else:
                      messages.error(request,&#39;Please provide valid details in the form&#39;)

              context = {&#39;form&#39;:form}
              return render(request, &#39;register.html&#39;, context)

      @unauthenticated_user
      def login_page(request):
              form =CreateUserForm()
              if request.method == &#39;POST&#39;:
                  username = request.POST.get(&#39;username&#39;)
                  password = request.POST.get(&#39;password&#39;)    

                  user = authenticate(request, username=username, password=password)

                  if user is not None:
                      login(request,user)
                      return redirect(&#39;to_user_login&#39;)
                  else:
                      messages.error(request,&#39;Username and Password does not match&#39;)

              context = {&#39;form&#39;:form}
              return render(request, &#39;login.html&#39;,context)    

      def logout_page(request):
          logout(request)
          return render(request,&#39;GFG.html&#39;) 

      @login_required(login_url=&quot;login&quot;)
      def to_user_login(request):
          group = request.user.groups.filter(user=request.user)[0]
          if group.name ==&quot;Admin&quot;:
              return HttpResponseRedirect(&#39;admin&#39;)
          elif group.name == &quot;Patient&quot;:
              return HttpResponseRedirect(&#39;patient&#39;)
          elif group.name == &quot;Doctor&quot;:
              return HttpResponseRedirect(&#39;doctor_front&#39;)
          return render(request, &#39;GFG.html&#39;)   

      def doctor_front(request):
          return render(request, &#39;doctor_front.html&#39;)

      def doctor(request):
          form = doctor_infos()
          user = get_user(request)
          if request.method == &#39;POST&#39;:
              try:
                  instance = get_object_or_404(models.doctor_infos, id = user)

                  form = doctor_infos(request.POST or None, instance = instance)
              except Exception as e:
                  form = doctor_infos(request.POST)
              if form.is_valid():
                  form.save()
                  return HttpResponseRedirect(&#39;doctor_front&#39;)
          else:
              try:
                  info = models.doctor_infos.objects.get(id = user)
                  form = doctor_infos(instance=info)
              except Exception as e:
                  email_id = user.email
                  form = doctor_infos(initial={&#39;id&#39;:user, &#39;email&#39;:email_id})
          context = {&#39;form&#39;: form}
          return render(request, &#39;doctor.html&#39;,context)             

      def patient(request):
          form = patient_info()
          user = get_user(request)
          if request.method == &#39;POST&#39;:
              try:
                  form = get_object_or_404(models.patient_info, user_name = user)

              except Exception as e:
                  form = models.patient_info()
              form.user_name = user
              form.email_id = user.email
              form.first_name = request.POST.get(&#39;first_name&#39;)
              form.last_name = request.POST.get(&#39;last_name&#39;)
              form.mobile_number = request.POST.get(&#39;mobile_number&#39;)
              form . state= request.POST.get(&#39;state&#39;)
              form.sex= request.POST.get(&#39;sex&#39;)
              form.city= request.POST.get(&#39;city&#39;)
              form.zip= request.POST.get(&#39;zip&#39;)
              form.dob = request.POST.get(&#39;dob&#39;)
              form.reason = request.POST.get(&#39;reason&#39;)
              form.family_doctor_name = request.POST.get(&#39;family_doctor_name&#39;)
              form.family_doctor_phone =request.POST.get(&#39;family_doctor_phone&#39;)
              form.current_medication_list = request.POST.get(&#39;current_medication_list&#39;)
              form.emergency_first_name = request.POST.get(&#39;emergency_first_name&#39;)
              form.emergency_last_name = request.POST.get(&#39;emergency_last_name&#39;)
              form.emergency_relationship = request.POST.get(&#39;emergency_relationship&#39;)
              form.emergency_mobile_number =  request.POST.get(&#39;emergency_mobile_number&#39;)
              form.address = request.POST.get(&#39;address&#39;)
              form.symptoms = request.POST.get(&#39;symptoms&#39;)
              form.doctor = request.POST.get(&#39;doctor&#39;)
              form.appointment_date = request.POST.get(&#39;appointment_date&#39;)
              form.status = True
              form.save()
              return HttpResponseRedirect(&#39;patient&#39;)
          else:
              try:
                  info = models.patient_info.objects.get(user_name = user)
                  form = patient_info(instance=info)
              except Exception as e:
                  email_id = user.email
                  form = patient_info(initial={&#39;user_name&#39;:user, &#39;email_id&#39;:email_id})
          doctor = models.doctor_infos.objects.all()
          context = {&#39;form&#39;: form,&#39;doctor&#39;:doctor}
          return render(request, &#39;patient.html&#39;,context)


      def appointment(request):
          user = get_user(request)
          patient = models.patient_info.objects.all().filter(doctor = user, status = True)
          if request.method == &#39;POST&#39;:

              if request.POST.get(&#39;accept&#39;):
                      patient_user_name = request.POST.get(&#39;accept&#39;)
                      pi = models.patient_info.objects.get(user_name = patient_user_name)
                      di = models.doctor_infos.objects.get(id = user)
                      doctor_name = di.first_name + &quot; &quot; + di.last_name
                      patient_name = pi.first_name + &quot; &quot; + pi.last_name
                      appointment_date = pi.appointment_date
                      doctor_phone_number = di.mobile_number
                      subject =&#39;&quot;Appointment with Doctor({}) has been confirmed&quot;&#39;.format(doctor_name)
                      message = &quot;Hi {}, your appointment has scheduled in the requested date {}. For more details please contact through this hospital mail or contact doctor through this {} phone number&quot;.format(patient_name, appointment_date,doctor_phone_number)
                      sa = models.scheduled_appointments()
                      sa.doctor = user
                      sa.patient = patient_name
                      sa.date = pi.appointment_date
                      sa.reason = pi.reason
                      sa.symptoms = pi.symptoms
                      sa.email_id = pi.email_id
                      sa.mobile_number = pi.mobile_number
                      sa.save()

              else:
                      patient_user_name = request.POST.get(&#39;reject&#39;)
                      pi = models.patient_info.objects.get(user_name = patient_user_name)
                      di = models.doctor_infos.objects.get(id = user)
                      doctor_name = di.first_name + &quot; &quot; + di.last_name
                      patient_name = pi.first_name + &quot; &quot; + pi.last_name
                      appointment_date = pi.appointment_date
                      doctor_phone_number = di.mobile_number
                      subject =&#39;&quot;Sorry appointment with Doctor({}) has been cancelled&quot;&#39;.format(doctor_name)
                      message = &quot;Hi {}, your appointment has cancelled for the date {}. Please try to consult the doctor with different date or try another doctor available, sorry for the inconvenince. For more details contact through this hospital mail&quot;.format(patient_name, appointment_date)

              email_from = &quot;YOUR EMAIL&quot;
              email_to = [pi.email_id]
              email = EmailMultiAlternatives(subject,message, email_from, email_to)
              email.send()
              pi.status = False
              pi.save()      
          scheduled = models.scheduled_appointments.objects.all().filter(doctor = user)   
          today = []
          future = []
          for s in scheduled:
              if s.date == date.today():
                  today.append(s.date)
              if s.date &gt; date.today():
                  future.append(s.date)    
          context ={&#39;patient&#39;:patient,&#39;scheduled&#39;:scheduled,&#39;today&#39;:today,&#39;future&#39;:future}
          return render(request, &#39;appointment.html&#39;,context)    
&lt;/textarea&gt; 
  
&lt;br /&gt;&lt;br /&gt;  
&lt;script async=&quot;&quot; crossorigin=&quot;anonymous&quot; src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot; data-ad-client=&quot;ca-pub-8963593429134655&quot; data-ad-format=&quot;fluid&quot; data-ad-layout=&quot;in-article&quot; data-ad-slot=&quot;3245859952&quot; style=&quot;display: block; text-align: center;&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;br /&gt;  
  
&lt;a id=&quot;head&quot;&gt;models.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;   
&lt;textarea style=&quot;height: 150vh;&quot; wrap=&quot;off&quot;&gt;
  
      from django.db import models
      from django.db.models import field

      class doctor_infos(models.Model):
          id = models.CharField(max_length=150, primary_key=True)
          email = models.CharField(max_length=320)
          first_name = models.CharField(max_length=20)
          last_name = models.CharField(max_length=20)
          state = models.CharField(max_length=20)
          address = models.CharField(max_length=100)
          sex = models.CharField(max_length=10)
          city = models.CharField(max_length=20)
          mobile_number = models.CharField(max_length=10)
          specialist_in = models.CharField(max_length=50)

          def __str__(self):
              return self.first_name + &quot; &quot; + self.last_name + &quot; &quot; + self.specialist_in


      class scheduled_appointments(models.Model):
          doctor = models.CharField(max_length=150,default=&quot;&quot;)
          patient = models.CharField(max_length = 50, default=&quot;&quot;)
          date = models.DateField(default=&quot;&quot;)
          reason = models.CharField(max_length=60,default = &quot;&quot;)
          symptoms = models.CharField(max_length=100,default=&quot;&quot;)
          email_id = models.CharField(max_length=320,default = &quot;&quot;)
          mobile_number = models.CharField(max_length=10)
          def __str__(self):
              return self.doctor + &quot; &quot; + self.patient       

      class patient_info(models.Model):
          user_name = models.CharField(primary_key=True, max_length=150)
          email_id = models.CharField(max_length=320,default = &quot;&quot;)
          first_name = models.CharField(max_length=20)
          last_name = models.CharField(max_length=20)
          mobile_number = models.CharField(max_length=10)
          state = models.CharField(max_length = 20)

          sex = models.CharField(max_length=6,blank=True, null=True)

          city = models.CharField(max_length = 20,default = &quot;&quot;)
          zip = models.CharField(max_length=6,default = &quot;&quot;)

          dob = models.DateField(default=&quot;&quot;)
          reason = models.CharField(max_length=60,default = &quot;&quot;)
          family_doctor_name = models.CharField(max_length=50,blank=True, null=True)
          family_doctor_phone = models.CharField(max_length=10,blank=True, null=True)
          current_medication_list = models.CharField(max_length=100,default = &quot;&quot;,blank=True, null=True)

          emergency_first_name = models.CharField(max_length = 30,default = &quot;&quot;)
          emergency_last_name = models.CharField(max_length = 30,default = &quot;&quot;)
          emergency_relationship = models.CharField(max_length = 20,default = &quot;&quot;)
          emergency_mobile_number = models.CharField(max_length = 10,blank=True, null=True)

          address = models.CharField(max_length=100,default=&quot;&quot;)
          symptoms = models.CharField(max_length=100,default=&quot;&quot;)

          doctor = models.CharField(unique=False,max_length=150, default=&quot;&quot;)
          status = models.BooleanField(default=False)
          appointment_date = models.CharField(max_length=11,blank=True, null=True,default=&quot;&quot;)


          def __str__(self):
              return self.first_name

&lt;/textarea&gt;
  
&lt;br /&gt;&lt;br /&gt;  
&lt;a id=&quot;head&quot;&gt;urls.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;   
&lt;textarea style=&quot;height: 60vh;&quot; wrap=&quot;off&quot;&gt;

      from django.urls import path
      from . import views

      urlpatterns = [
          path(&#39;&#39;,views.home, name=&quot;home&quot;),
          path(&#39;home&#39;,views.home),
          path(&#39;register&#39;,views.register, name=&quot;register&quot;),
          path(&#39;login_page&#39;,views.login_page, name=&quot;login&quot;),
          path(&#39;logout_user&#39;,views.logout_page,name=&quot;logout&quot;),
          path(&#39;to_user_login&#39;,views.to_user_login,name=&quot;to_user_login&quot;),
          path(&#39;patient&#39;,views.patient,name=&quot;patient&quot;),
          path(&#39;doctor_front&#39;,views.doctor_front,name=&quot;doctor_front&quot;),
          path(&#39;doctor&#39;,views.doctor,name=&quot;doctor&quot;),
          path(&#39;appointment&#39;,views.appointment, name=&quot;appointment&quot;)
      ]   

&lt;/textarea&gt;  
  
&lt;br /&gt;&lt;br /&gt;  
&lt;a id=&quot;head&quot;&gt;forms.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;   
&lt;textarea style=&quot;height: 150vh;&quot; wrap=&quot;off&quot;&gt;

      from typing import Type
      from django.forms import ModelForm, fields, ModelChoiceField,MultipleChoiceField
      from django.contrib.auth.forms import UserCreationForm
      from django import forms
      from. models import patient_info, doctor_infos
      from django.contrib.auth.models import User
      from django.forms.widgets import DateInput, TimeInput


      class CreateUserForm(UserCreationForm):
          class Meta:
              model = User
              fields =[&#39;username&#39;, &#39;email&#39;, &#39;password1&#39;, &#39;password2&#39;]
              error_message = {
                  &#39;username&#39;:{
                      &#39;unique&#39;: &#39;username must only contains let,num,char(@ . + - _)&#39;
                  }
              }


      class patient_info(ModelForm):
          class Meta:
              model = patient_info
              exclude = (&#39;status&#39;,&#39;doctor&#39;)
              fields = &#39;__all__&#39;
              labels = {
                  &#39;first_name&#39;: (&#39;First Name&#39;),
                  &#39;last_name&#39;: (&#39;Last Name&#39;),
                  &#39;mobile_number&#39;: (&#39;Mobile Number&#39;),
                  &#39;address&#39;: (&#39;Address&#39;),
                  &#39;state&#39;: (&#39;State&#39;),
                  &#39;sex&#39;: (&#39;Sex&#39;),
                  &#39;city&#39;: (&#39;City Name&#39;),
                  &#39;zip&#39;: (&#39;Pin Code&#39;),
                  &#39;dob&#39;: (&#39;D.O.B&#39;),
                  &#39;reason&#39;:(&#39;Reason&#39;),
                  &#39;family_doctor_name&#39;: (&#39;Family Doctor Name&#39;),
                  &#39;family_doctor_phone&#39;: (&#39;Family Doctor Phone&#39;),
                  &#39;current_medication_list&#39;: (&#39;Current Medication&#39;),
                  &#39;emergency_first_name&#39;: (&#39;Emergency Person First Name&#39;),
                  &#39;emergency_relationship&#39; : (&#39;Emergency Person Relationship&#39;),
                  &#39;emergency_mobile_number&#39; :(&#39;Emergency Person Mobile Number&#39;),
                  &#39;symptoms&#39;: (&#39;Symptoms&#39;),
                  &#39;doctor&#39;: (&#39;Available Doctors&#39;),
                  &#39;appointment_date&#39;: (&#39;Appointment Date&#39;),

              }
              widgets = {
              &#39;dob&#39;: DateInput(attrs={&#39;type&#39;: &#39;date&#39;}),
              &#39;appointment_date&#39;: DateInput(attrs={&#39;type&#39;: &#39;date&#39;}),
              }

      class doctor_infos(ModelForm):
          class Meta:
              model = doctor_infos
              # exclude = (&#39;id&#39;,&#39;email&#39;,)
              fields = &#39;__all__&#39;
              labels = {
                  &#39;id&#39;: (&#39;User Name&#39;),
                  &#39;email&#39;: (&#39;Email ID&#39;),
                  &#39;first_name&#39;: (&#39;First Name&#39;),
                  &#39;last_name&#39;: (&#39;Last Name&#39;),
                  &#39;mobile_number&#39;: (&#39;Mobile Number&#39;),
                  &#39;address&#39;: (&#39;Address&#39;),
                  &#39;state&#39;: (&#39;State&#39;),
                  &#39;sex&#39;: (&#39;Sex&#39;),
                  &#39;city&#39;: (&#39;City Name&#39;),
                  &#39;specialist_in&#39;:(&#39;Specialized In&#39;),

              }
              widgets = {
              &#39;dob&#39;: DateInput(attrs={&#39;type&#39;: &#39;date&#39;})
              }                  
&lt;/textarea&gt;  
  
&lt;br /&gt;&lt;br /&gt;  
&lt;a id=&quot;head&quot;&gt;decorators.py&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;   
&lt;textarea style=&quot;height: 40vh;&quot; wrap=&quot;off&quot;&gt;

      from django.shortcuts import redirect

      def unauthenticated_user(view_func):
          def wrapper_func(request, *args, **kwargs):
              if request.user.is_authenticated:
                  return redirect(&#39;to_user_login&#39;)
              else:
                  return view_func(request, *args, **kwargs)
          return wrapper_func
&lt;/textarea&gt;  
&lt;br /&gt;
  
&lt;a id=&quot;head&quot;&gt;Mail&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
And to send email enter you Mail ID in EMAIL_HOST_USER in settings.py and the enter your email app password in EMAIL_HOST_PASSWORD in settings.py. If you doesn&#39;t have a email app password sign-in into your Google Account and create a app password for Email and enter here. And enter you Mail ID in views.py in the &#39;email_from&#39; field.
&lt;br /&gt;&lt;br /&gt;

&lt;textarea style=&quot;height: 25vh;&quot; wrap=&quot;off&quot;&gt;

    EMAIL_HOST = &#39;smtp.gmail.com&#39;
    EMAIL_PORT = 587
    EMAIL_HOST_USER = &#39;YOUR EMAIL&#39;
    EMAIL_HOST_PASSWORD = &#39;APP PASSWORD&#39;
    EMAIL_USE_TLS = True
&lt;/textarea&gt;   
&lt;br /&gt;&lt;br /&gt;  
  
&lt;a id=&quot;head&quot;&gt;Conclusion&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
Thus the Doctor Appointment Booking System has been successfully created and implemented by including the required fundamental features. 
&lt;br /&gt;&lt;br /&gt;  
&lt;a href=&quot;https://github.com/GoGokul/Doctor-Appointment-Booking-System&quot;&gt;Click here to see full project code in GitHub Repositorie.&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;    
  
&lt;/span&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/7430813763827660279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2022/01/doctor-appointment-booking-system-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/7430813763827660279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/7430813763827660279'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2022/01/doctor-appointment-booking-system-with.html' title='Doctor Appointment Booking System with source code'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEio0B204V3zZ528SafbFnHuVrKEZR5Af8Fzrhbicjh26eiNqzDPF5QVRkS2lZ8FHDHZNUbzvOt6zfNOVnT0cg7vF27PP5onatc5yM8ccxLnjqEYjNmuRt9sKR87nDLybtD6h2aMjK3EtGDQcDgNqLUyRMlBdnK6aHycAJnh0iuHU_0Ji8VLi3ps7aotVg=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-4039315914490437704</id><published>2022-01-07T20:37:00.002+05:30</published><updated>2022-02-28T14:15:11.398+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="how to use for loop and if condition in a html template django"/><title type='text'>How to use for loop and if condition in a Html Template - Django</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;

&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
Here we are going to display a Student&#39;s Timetable using for loop and if condition in a Html Template in Django.  
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiDT3LkNnWmXSHkQT9GtPUebqRKXrc2n_r0d26hQTLA7kIhUPwi8e8sBCVZ-QFyYIPLE1x4cP3vnN3N0TOte9wuvmJdxTNoz_eD_-D4W4XcSL4Tss-bXomQs5UcG4UpzuushXD28QSOhQYg64rPe23-6sT-GRNdKh-dBDbql9ZowravfH2k4tiXhVXYbA=s676&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;568&quot; data-original-width=&quot;676&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiDT3LkNnWmXSHkQT9GtPUebqRKXrc2n_r0d26hQTLA7kIhUPwi8e8sBCVZ-QFyYIPLE1x4cP3vnN3N0TOte9wuvmJdxTNoz_eD_-D4W4XcSL4Tss-bXomQs5UcG4UpzuushXD28QSOhQYg64rPe23-6sT-GRNdKh-dBDbql9ZowravfH2k4tiXhVXYbA=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;

&lt;br&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:21vh;&quot;&gt;
	 {% for sub in subject %}
          {% if sub.identity_number == mon.identity_number %}
              {{sub.subject}}
          {% endif %}
      {% endfor %}
&lt;/textarea&gt;  
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
As shown above a single bracket and a percentage symbol is to be used for the declaration of both For-Loop and if condition in Django Html Template. Variable used in a For-Loop must always have to be an iterable one or it may end in non-iterable error. For example models.assign_time_table.objects.all().filter() or it has to be something like list. You can&#39;t iterate through a single object. As for If condition the variable has to be a non-iterable variable else it can&#39;t be used in If condition.
&lt;br/&gt;&lt;br/&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:40vh;&quot;&gt;
  
	&lt;td&gt;
      {% for mon in mon_time_10 %}  
      {% for sub in subject %}
          {% if sub.identity_number == mon.identity_number %}
              {{sub.subject}}
          {% endif %}
      {% endfor %}
      {% endfor %}
      &lt;/td&gt;
&lt;/textarea&gt;   
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
mon_time_10 time which means Monday@10 a single object which also can be looped because if it is filtered with objects.all().filter(). Suppose if the variable is filtered with objects.get() which will cause a non-iterable error.        
&lt;br/&gt;&lt;br/&gt;  
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
Make sure you filter as much as you can in the views page not in the Html Template. Use Template For and If tags if required.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Code&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
 

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:160vh;&quot;&gt;

&lt;h3 id=&quot;head&quot;&gt;Loged in as Student&lt;span id=&quot;u_name&quot;&gt; Hello, {{request.user}}&lt;/span&gt;&lt;/h3&gt;

&lt;div style=&quot;display: flex;&quot;&gt;
&lt;br&gt;&lt;br&gt;
&lt;form action=&quot;&quot; method=&quot;post&quot; id=&quot;&quot;&gt;
  {% csrf_token %}

  &lt;h3 id=&quot;form_head&quot;&gt;Classes assigned to&lt;/h3&gt;
  &lt;table border=&quot;5&quot;&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Student Name&lt;/th&gt;
        &lt;th&gt;Student Register Number&lt;/th&gt;
        &lt;th&gt;Department&lt;/th&gt;
        &lt;th&gt;Batch Start Year&lt;/th&gt;
        &lt;th&gt;Batch End Year&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tr&gt;
      &lt;td&gt;{{student.first_name}} {{student.last_name}}&lt;/td&gt;
      &lt;td&gt;{{student.register_number}}&lt;/td&gt;
      &lt;td&gt;{{student.degree}}&lt;/td&gt;
      &lt;td&gt;{{student.course_start_year}}&lt;/td&gt;
      &lt;td&gt;{{student.course_end_year}}&lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;


&lt;h3 id=&quot;head&quot;&gt;Assigned time table&lt;/h3&gt;


&lt;br&gt;
&lt;div style=&quot;display: flex;&quot;&gt;

  &lt;table border=&quot;3&quot;&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Day/Time&lt;/th&gt;
        &lt;th&gt;10:00-10:50&lt;/th&gt;
        &lt;th&gt;11:00-11:50&lt;/th&gt;
        &lt;th&gt;12:00-13:00&lt;/th&gt;
        &lt;th&gt;14:00-14:50&lt;/th&gt;
        &lt;th&gt;15:00-15:50&lt;/th&gt;
        &lt;th&gt;16:00-17:00&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;

    &lt;tr&gt;
      &lt;th&gt;Monday&lt;/th&gt;
      &lt;td&gt;
      {% for mon in mon_time_10 %}  
      {% for sub in subject %}
          {% if sub.identity_number == mon.identity_number %}
              {{sub.subject}}
          {% endif %}
      {% endfor %}
      {% endfor %}
      &lt;/td&gt;
      &lt;td&gt;
        {% for mon in mon_time_11 %} 
        {% for sub in subject %}
            {% if sub.identity_number == mon.identity_number %}
                {{sub.subject}}
            {% endif %}
        {% endfor %}
        {% endfor %}
        &lt;/td&gt;
        &lt;td&gt;
          {% for mon in mon_time_12 %} 
          {% for sub in subject %}
              {% if sub.identity_number == mon.identity_number %}
                  {{sub.subject}}
              {% endif %}
          {% endfor %}
          {% endfor %}
          &lt;/td&gt;
          &lt;td&gt;
            {% for mon in mon_time_14 %} 
            {% for sub in subject %}
                {% if sub.identity_number == mon.identity_number %}
                    {{sub.subject}}
                {% endif %}
            {% endfor %}
            {% endfor %}
            &lt;/td&gt;
            &lt;td&gt;
              {% for mon in mon_time_15 %} 
              {% for sub in subject %}
                  {% if sub.identity_number == mon.identity_number %}
                      {{sub.subject}}
                  {% endif %}
              {% endfor %}
              {% endfor %}
              &lt;/td&gt;
              &lt;td&gt;
                {% for mon in mon_time_16 %} 
                {% for sub in subject %}
                    {% if sub.identity_number == mon.identity_number %}
                        {{sub.subject}}
                    {% endif %}
                {% endfor %}
                {% endfor %}
                &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;th&gt;Tuesday&lt;/th&gt;
      &lt;td&gt;
      {% for tue in tue_time_10 %}   
      {% for sub in subject %}
          {% if sub.identity_number == tue.identity_number %}
              {{sub.subject}}
          {% endif %}
      {% endfor %}
      {% endfor %}
      &lt;/td&gt;
      &lt;td&gt;
        {% for tue in tue_time_11 %}
        {% for sub in subject %}
            {% if sub.identity_number == tue.identity_number %}
                {{sub.subject}}
            {% endif %}
        {% endfor %}
        {% endfor %}
        &lt;/td&gt;
        &lt;td&gt;
          {% for tue in tue_time_12 %}
          {% for sub in subject %}
              {% if sub.identity_number == tue.identity_number %}
                  {{sub.subject}}
              {% endif %}
          {% endfor %}
          {% endfor %}
          &lt;/td&gt;
          &lt;td&gt;
            {% for tue in tue_time_14 %}
            {% for sub in subject %}
                {% if sub.identity_number == tue.identity_number %}
                    {{sub.subject}}
                {% endif %}
            {% endfor %}
            {% endfor %}
            &lt;/td&gt;
            &lt;td&gt;
              {% for tue in tue_time_15 %}
              {% for sub in subject %}
                  {% if sub.identity_number == tue.identity_number %}
                      {{sub.subject}}
                  {% endif %}
              {% endfor %}
              {% endfor %}
              &lt;/td&gt;
              &lt;td&gt;
                {% for tue in tue_time_16 %}
                {% for sub in subject %}
                    {% if sub.identity_number == tue.identity_number %}
                        {{sub.subject}}
                    {% endif %}
                {% endfor %}
                {% endfor %}
                &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;th&gt;Wednesday&lt;/th&gt;
      &lt;td&gt;
      {% for wed in wed_time_10 %}  
      {% for sub in subject %}
          {% if sub.identity_number == wed.identity_number %}
              {{sub.subject}}
          {% endif %}
      {% endfor %}
      {% endfor %}
      &lt;/td&gt;
      &lt;td&gt;
        {% for wed in wed_time_11 %}
        {% for sub in subject %}
            {% if sub.identity_number == wed.identity_number %}
                {{sub.subject}}
            {% endif %}
        {% endfor %}
        {% endfor %}
        &lt;/td&gt;
        &lt;td&gt;
          {% for wed in wed_time_12 %}
          {% for sub in subject %}
              {% if sub.identity_number == wed.identity_number %}
                  {{sub.subject}}
              {% endif %}
          {% endfor %}
          {% endfor %}
          &lt;/td&gt;
          &lt;td&gt;
            {% for wed in wed_time_14 %}
            {% for sub in subject %}
                {% if sub.identity_number == wed.identity_number %}
                    {{sub.subject}}
                {% endif %}
            {% endfor %}
            {% endfor %}
            &lt;/td&gt;
            &lt;td&gt;
              {% for wed in wed_time_15 %}
              {% for sub in subject %}
                  {% if sub.identity_number == wed.identity_number %}
                      {{sub.subject}}
                  {% endif %}
              {% endfor %}
              {% endfor %}
              &lt;/td&gt;
              &lt;td&gt;
                {% for wed in wed_time_16 %}
                {% for sub in subject %}
                    {% if sub.identity_number == wed.identity_number %}
                        {{sub.subject}}
                    {% endif %}
                {% endfor %}
                {% endfor %}
                &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;th&gt;Thursday&lt;/th&gt;
      &lt;td&gt;
      {% for thu in thu_time_10 %}  
      {% for sub in subject %}
          {% if sub.identity_number == thu.identity_number %}
              {{sub.subject}}
          {% endif %}
      {% endfor %}
      {% endfor %}
      &lt;/td&gt;
      &lt;td&gt;
        {% for thu in thu_time_11 %}
        {% for sub in subject %}
            {% if sub.identity_number == thu.identity_number %}
                {{sub.subject}}
            {% endif %}
        {% endfor %}
        {% endfor %}
        &lt;/td&gt;
        &lt;td&gt;
          {% for thu in thu_time_16 %}
          {% for sub in subject %}
              {% if sub.identity_number == thu.identity_number %}
                  {{sub.subject}}
              {% endif %}
          {% endfor %}
          {% endfor %}
          &lt;/td&gt;
          &lt;td&gt;
            {% for thu in thu_time_16 %}
            {% for sub in subject %}
                {% if sub.identity_number == thu.identity_number %}
                    {{sub.subject}}
                {% endif %}
            {% endfor %}
            {% endfor %}
            &lt;/td&gt;
            &lt;td&gt;
              {% for thu in thu_time_16 %}
              {% for sub in subject %}
                  {% if sub.identity_number == thu.identity_number %}
                      {{sub.subject}}
                  {% endif %}
              {% endfor %}
              {% endfor %}
              &lt;/td&gt;
              &lt;td&gt;
                {% for thu in thu_time_16 %}
                {% for sub in subject %}
                    {% if sub.identity_number == thu.identity_number %}
                        {{sub.subject}}
                    {% endif %}
                {% endfor %}
                {% endfor %}
                &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;th&gt;Friday&lt;/th&gt;
      &lt;td&gt;
      {% for fri in fri_time_10 %}  
      {% for sub in subject %}
          {% if sub.identity_number == fri.identity_number %}
              {{sub.subject}}
          {% endif %}
      {% endfor %}
      {% endfor %}
      &lt;/td&gt;
      &lt;td&gt;
        {% for fri in fri_time_11 %} 
        {% for sub in subject %}
            {% if sub.identity_number == fri.identity_number %}
                {{sub.subject}}
            {% endif %}
        {% endfor %}
        {% endfor %}
        &lt;/td&gt;
        &lt;td&gt;
          {% for fri in fri_time_12 %} 
          {% for sub in subject %}
              {% if sub.identity_number == fri.identity_number %}
                  {{sub.subject}}
              {% endif %}
          {% endfor %}
          {% endfor %}
          &lt;/td&gt;
          &lt;td&gt;
            {% for fri in fri_time_14 %} 
            {% for sub in subject %}
                {% if sub.identity_number == fri.identity_number %}
                    {{sub.subject}}
                {% endif %}
            {% endfor %}
            {% endfor %}
            &lt;/td&gt;
            &lt;td&gt;
              {% for fri in fri_time_15 %} 
              {% for sub in subject %}
                  {% if sub.identity_number == fri.identity_number %}
                      {{sub.subject}}
                  {% endif %}
              {% endfor %}
              {% endfor %}
              &lt;/td&gt;
              &lt;td&gt;
                {% for fri in fri_time_16 %} 
                {% for sub in subject %}
                    {% if sub.identity_number == fri.identity_number %}
                        {{sub.subject}}
                    {% endif %}
                {% endfor %}
                {% endfor %}
                &lt;/td&gt;
    &lt;/tr&gt;    

    &lt;tr&gt;
      &lt;th&gt;Saturday&lt;/th&gt;
      &lt;td&gt;
      {% for sat in sat_time_10 %}  
      {% for sub in subject %}
          {% if sub.identity_number == sat.identity_number %}
              {{sub.subject}}
          {% endif %}
      {% endfor %}
      {% endfor %}
      &lt;/td&gt;
      &lt;td&gt;
        {% for sat in sat_time_11 %}
        {% for sub in subject %}
            {% if sub.identity_number == sat.identity_number %}
                {{sub.subject}}
            {% endif %}
        {% endfor %}
        {% endfor %}
        &lt;/td&gt;
        &lt;td&gt;
          {% for sat in sat_time_12 %}
          {% for sub in subject %}
              {% if sub.identity_number == sat.identity_number %}
                  {{sub.subject}}
              {% endif %}
          {% endfor %}
          {% endfor %}
          &lt;/td&gt;
          &lt;td&gt;
            {% for sat in sat_time_14 %}
            {% for sub in subject %}
                {% if sub.identity_number == sat.identity_number %}
                    {{sub.subject}}
                {% endif %}
            {% endfor %}
            {% endfor %}
            &lt;/td&gt;
            &lt;td&gt;
              {% for sat in sat_time_15 %}
              {% for sub in subject %}
                  {% if sub.identity_number == sat.identity_number %}
                      {{sub.subject}}
                  {% endif %}
              {% endfor %}
              {% endfor %}
              &lt;/td&gt;
              &lt;td&gt;
                {% for sat in sat_time_16 %}
                {% for sub in subject %}
                    {% if sub.identity_number == sat.identity_number %}
                        {{sub.subject}}
                    {% endif %}
                {% endfor %}
                {% endfor %}
                &lt;/td&gt;
    &lt;/tr&gt;

    &lt;tr&gt;
      &lt;th&gt;Sunday&lt;/th&gt;
      &lt;td&gt;
      {% for sun in sun_time_10 %}
      {% for sub in subject %}
          {% if sub.identity_number == sun.identity_number %}
              {{sub.subject}}
          {% endif %}
      {% endfor %}
      {% endfor %}
      &lt;/td&gt;
      &lt;td&gt;
        {% for sun in sun_time_11 %}
        {% for sub in subject %}
            {% if sub.identity_number == sun.identity_number %}
                {{sub.subject}}
            {% endif %}
        {% endfor %}
        {% endfor %}
        &lt;/td&gt;
        &lt;td&gt;
          {% for sun in sun_time_12 %}
          {% for sub in subject %}
              {% if sub.identity_number == sun.identity_number %}
                  {{sub.subject}}
              {% endif %}
          {% endfor %}
          {% endfor %}
          &lt;/td&gt;
          &lt;td&gt;
            {% for sun in sun_time_14 %}
            {% for sub in subject %}
                {% if sub.identity_number == sun.identity_number %}
                    {{sub.subject}}
                {% endif %}
            {% endfor %}
            {% endfor %}
            &lt;/td&gt;
            &lt;td&gt;
              {% for sun in sun_time_15 %}
              {% for sub in subject %}
                  {% if sub.identity_number == sun.identity_number %}
                      {{sub.subject}}
                  {% endif %}
              {% endfor %}
              {% endfor %}
              &lt;/td&gt;
              &lt;td&gt;
                {% for sun in sun_time_16 %}
                {% for sub in subject %}
                    {% if sub.identity_number == sun.identity_number %}
                        {{sub.subject}}
                    {% endif %}
                {% endfor %}
                {% endfor %}
                &lt;/td&gt;
    &lt;/tr&gt;    
&lt;/table&gt;
&lt;/div&gt;

{% endblock %}
&lt;/textarea&gt;
&lt;br&gt;&lt;br&gt;  
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/4039315914490437704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2022/01/how-to-use-for-loop-and-if-condition-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4039315914490437704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4039315914490437704'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2022/01/how-to-use-for-loop-and-if-condition-in.html' title='How to use for loop and if condition in a Html Template - Django'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEiDT3LkNnWmXSHkQT9GtPUebqRKXrc2n_r0d26hQTLA7kIhUPwi8e8sBCVZ-QFyYIPLE1x4cP3vnN3N0TOte9wuvmJdxTNoz_eD_-D4W4XcSL4Tss-bXomQs5UcG4UpzuushXD28QSOhQYg64rPe23-6sT-GRNdKh-dBDbql9ZowravfH2k4tiXhVXYbA=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-5738466222170799498</id><published>2021-12-09T06:26:00.004+05:30</published><updated>2022-02-21T20:44:11.801+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="html code for marksheet"/><category scheme="http://www.blogger.com/atom/ns#" term="Responsive marksheet design sample in html code"/><category scheme="http://www.blogger.com/atom/ns#" term="student marksheet html code"/><title type='text'>Marksheet design sample in html code responsive one</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt; 
  
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;

&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
Designing a responsive student marksheet code with html and css which allows us to maintain alignment of the code without breaking into parts, depending on the screen sizes.  
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEifL6zy_eihHkZtM1iOBtT8RMEAwJseRXXzGl2QGAjlYMOVi7w62e9BtzWCVq682ShUddT_hMOhSSNxhtmcj6uv32fUoTMhyznIpS04JTcshgNQ4brH9HZofu1FBN-H0BWf6ZQoqngM7OaSIpsvbpystDW1mp8rYgUCJgGw0IvidN_ekpJ5w5BXNvb_qg=s615&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;600&quot; data-original-height=&quot;367&quot; data-original-width=&quot;615&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEifL6zy_eihHkZtM1iOBtT8RMEAwJseRXXzGl2QGAjlYMOVi7w62e9BtzWCVq682ShUddT_hMOhSSNxhtmcj6uv32fUoTMhyznIpS04JTcshgNQ4brH9HZofu1FBN-H0BWf6ZQoqngM7OaSIpsvbpystDW1mp8rYgUCJgGw0IvidN_ekpJ5w5BXNvb_qg=s600&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
The code is going to contain a responsive &lt;a href=&quot;https://www.knowsabouts.in/2021/08/full-fledged-responsive-top-navigation.html&quot;&gt;top navigation bar &lt;/a&gt;along with the student marksheet code. Going with percentage and view width and height instead of going with pixels or centimetres or any other lengths gives us a responsive student marksheet design. Let&#39;s assume the marksheet table has to be on the centre of the page with 50 percent of the screen&#39;s size. If it&#39;s a fixed screen then we can go with a fixed value for this we will go with 50% this will automatically assign the table size to 50 percent of the screen&#39;s size.  
&lt;br&gt;&lt;br&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:21vh;&quot;&gt;
	 table{
           background-color: gainsboro;
           border: 0px;
           width: 50%;
  	 }
&lt;/textarea&gt;  
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;

Here I am going with the register number as a primary key to fetch data from the database. You also can use a composite primary key using multiple columns to form a primary key something like register number + data of birth. For that we need a textbox and button to get the register number from the user. Once the button is triggered the given register will be checked with the database to show the student&#39;s mark.

&lt;br/&gt;&lt;br/&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:40vh;&quot;&gt;
  
	&lt;form action=&quot;get_marks&quot;  id=&quot;search&quot; style=&quot;font-size: 1.5vw;&quot;&gt;
      
          	&lt;label for=&quot;register_number&quot;&gt;Register Number: &lt;/label&gt;
          	&lt;input id=&quot;register_number&quot;
          	oninput=&quot;this.value=this.value.slice(0,this.maxLength)&quot;
          	type=&quot;number&quot; required name=&quot;register_number&quot; maxlength=&quot;9&quot;&gt;
      
          	&lt;button id=&quot;submit&quot; type=&quot;submit&quot; &gt;Get Marks&lt;/button&gt;
      &lt;/form&gt;
&lt;/textarea&gt;   
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
Once the get marks button is clicked the form&#39;s action attribute added to the url to submit the form. Here the input box is restricted which allows only numbers with the length of 9.  
           
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;&lt;/a&gt;&lt;br/&gt;
Here I am going to use two tables, one is to show the student details and another one is to show the student&#39;s marks. Aligning text to the centre of the page along with the table by setting width and height to auto. Theme of the marksheet table is done with the help of multiple ids or tags.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Code&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
   
&lt;br&gt;


&lt;textarea  wrap=&quot;off&quot; style=&quot;height:160vh;&quot;&gt;
      
    &lt;!DOCTYPE html&gt;
    &lt;html lang=&quot;en&quot;&gt;
    &lt;head&gt;
        &lt;meta charset=&quot;UTF-8&quot;&gt;
        &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
        &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
        &lt;title&gt;Marksheet Result Page&lt;/title&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot;&gt;

        &lt;style&gt;
            *{
                background-color: white;
                transition: all .20s ease;
            }

            #content{
                width: auto;
                font-family:FontAwesome;
                margin-top:5%;
                margin-left: 10%;
                text-align: center;
            }

            #top-nav-bar{
                border-bottom:1px solid red;
                border-top:1px solid red;
                padding: 10px;
                text-align: center;
                font-family:FontAwesome;
                font-weight:400;
                font-size:12px;
                width: 100%;
                display: flex;
                height: auto;
                box-sizing: border-box;
                position: relative;
                margin: 0 auto;
                overflow: visible;
                justify-content: space-between;
                z-index: 10;
            }

            #web-name{
                float:left;
                padding-left: 5%;
                font-size:16px;
                display: block;
                font-family: Arial;
            }
            #main-menu{
                float: right;
                padding-left:5%;
                display: block;
                font-family: Arial;
            }
            #print, #reset{
                padding:0px;
            }
            a{
                padding-left: 25px;
                text-decoration: none;
                color: black;
                font-weight: bold;
            }
            a:hover{
                color: red;
            }
            li{
                display: inline-block;
            }
            #mob-nav-open, #mob-nav-close{
                top:20px;
                right: 10px;
                position: absolute;
                padding:0 0 0 20px;
                display: none;
                transition: 2s;
            }
            table{
                background-color: gainsboro;
                border: 0px;
                width: 50%;
                margin-left: 25%;
                margin-right: 25%;
                text-align: center;
            }
            table tr{
                color:black;
            }
            th{
                text-align: center;
                background-color:#DAA520;
            }
            td{
                text-align: center;
                background-color:#FFFACD
            }
            #m, #t{
                background-color: #EEE8AA;
            }
            span{
                margin-right: 0px;
                color:red;
                font-weight: bold;
                width:auto;
                height: auto;
                font-size: 1.3vw;
            }
            #search, input, button{
                font-size: 1.2vw;
                size: 1.5vw;
            }
            button{
                cursor:pointer;
            }

            @media  screen and (max-width:850px){

                #web-name{
                    padding-left: 0px;
                }
                #main-menu{
                    display:none;
                }
                #mob-nav-open{
                    display: block;
                }
                #top-nav-bar{
                    display: block;
                }
                #top-nav-bar{
                    flex-direction: column;
                    align-items: flex-start;
                    display: flex;

                }
                #main-menu{
                    width: 100%;
                    height: 100%;
                    transition: 1s ease;
                    z-index: 20;
                    text-align: left;
                }
                li{
                    display:block;
                    padding: 10px;
                    border-top: 1px solid red;
                    font-family: FontAwesome;
                    font-size: 12px;
                    font-weight: bold;
                }
                li &gt; a{
                    display: inline-block;
                    width: 98%;
                }
            }

        &lt;/style&gt;   

        &lt;script&gt;
    function mobnav(){
        var a = document.getElementById(&quot;main-menu&quot;);
        var open = document.getElementById(&quot;mob-nav-open&quot;);
        var close = document.getElementById(&quot;mob-nav-close&quot;);
        open.style.display =&quot;none&quot;;
        close.style.display =&quot;block&quot;;
        if(a.style.display === &quot;block&quot;){
            a.style.display = &quot;none&quot;;
        }
        else{
        a.style.display = &#39;block&#39;;
        }
    }
        // OPEN TOP MOBILE NAVIGATION TOGGLE
    function mobnavclose(){
        var a = document.getElementById(&quot;main-menu&quot;);
        var open = document.getElementById(&quot;mob-nav-open&quot;);
        var close = document.getElementById(&quot;mob-nav-close&quot;);
        open.style.display = &quot;&quot;;
        close.style.display = &quot;none&quot;;
        a.style.display = &quot;&quot;;
    }
        &lt;/script&gt;
    &lt;/head&gt;
    &lt;body &gt;
    &lt;div class=&quot;container&quot;&gt;
        &lt;!-- TOP NAVIGATION BAR     --&gt;
        &lt;div class=&quot;top-nav-bar&quot; id=&quot;top-nav-bar&quot;&gt;
            &lt;!-- WEBSITE NAME OR LOGO --&gt;
            &lt;div class=&quot;web-name&quot; id=&quot;web-name&quot; title=&quot;website&quot;&gt;
               &lt;a href=&quot;home&quot;&gt;MARKSHEET RESULT&lt;/a&gt; &lt;br&gt;
               &lt;a style=&quot;color: blue; font-size: 10px;&quot;&gt;marksheet result page&lt;/a&gt; 
            &lt;/div&gt;
            &lt;!-- MAIN MENU --&gt;
            &lt;ul class=&quot;main-menu&quot; id=&quot;main-menu&quot; title=&quot;main menu&quot;&gt;
                &lt;li&gt;&lt;a href=&quot;admin&quot; title=&quot;admin login&quot;&gt;ADMIN&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;home&quot; title=&quot;home&quot;&gt;HOME&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;result&quot; title=&quot;result&quot;&gt;RESULT&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;register&quot; title=&quot;register&quot;&gt;SIGNUP&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;login_page&quot; title=&quot;login&quot;&gt;LOGIN&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;logout_user&quot; title=&quot;logout&quot;&gt;LOGOUT&lt;/a&gt;&lt;/li&gt;
                &lt;/ul&gt;

            &lt;a href=&quot;javascript:void(0);&quot; id=&quot;mob-nav-open&quot; class=&quot;icon&quot; onclick=&quot;mobnav()&quot;&gt;
            &lt;i class=&quot;fa fa-bars fa-lg&quot;&gt;&lt;/i&gt;
            &lt;/a&gt;
            &lt;a href=&quot;javascript:void(0);&quot; id=&quot;mob-nav-close&quot; class=&quot;icon&quot; onclick=&quot;mobnavclose()&quot;&gt;
                &lt;i class=&quot;fas fa-times fa-lg&quot;&gt;&lt;/i&gt;
                &lt;/a&gt;
        &lt;/div&gt; 


        &lt;!-- Main Content --&gt;
        &lt;div id=&quot;content&quot;&gt;
            &lt;form action=&quot;get_marks&quot;  id=&quot;search&quot; style=&quot;font-size: 1.5vw;&quot;&gt;
              &lt;label for=&quot;register_number&quot;&gt;Register Number: &lt;/label&gt;
              &lt;input id=&quot;register_number&quot;
              oninput=&quot;this.value=this.value.slice(0,this.maxLength)&quot;
              type=&quot;number&quot; required name=&quot;mobile_number&quot; maxlength=&quot;9&quot;&gt;
              &lt;button id=&quot;submit&quot; type=&quot;submit&quot; &gt;Get Marks&lt;/button&gt;
            &lt;/form&gt;
            &lt;br&gt;&lt;br&gt;

               &lt;span&gt;&lt;a id=&quot;print&quot; href=&quot;print&quot;&gt;Print&lt;/span&gt;|&lt;a id=&quot;reset&quot; href=&quot;reset&quot;&gt;Reset&lt;/a&gt;&lt;/span&gt;
               &lt;table &gt;
                &lt;tr &gt;
                    &lt;th id=&quot;t&quot;&gt; Register Number &lt;/th&gt;
                    &lt;td&gt; 211704018 &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;th id=&quot;t&quot;&gt; Name &lt;/th&gt;
                    &lt;td&gt; DINESH P &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;th id=&quot;t&quot;&gt; Date Of Birth &lt;/th&gt;
                    &lt;td&gt; 29/01/2000 &lt;/td&gt;
                &lt;/tr&gt;
               &lt;/table&gt;

               &lt;table&gt;
                &lt;tr&gt;
                    &lt;th&gt; Subject Code &lt;/th&gt;&lt;br&gt;
                    &lt;th&gt; UE &lt;/th&gt;
                    &lt;th&gt; IA &lt;/th&gt;
                    &lt;th&gt; Total &lt;/th&gt;
                    &lt;th&gt; Result &lt;/th&gt;
                &lt;/tr&gt;

                &lt;tr&gt;
                    &lt;td&gt; ENV4B &lt;/td&gt;
                    &lt;td&gt; 064 &lt;/td&gt;
                    &lt;td&gt; 025 &lt;/td&gt;
                    &lt;td&gt; 089 &lt;/td&gt;
                    &lt;td&gt; P &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td id=&quot;m&quot;&gt; SAZ41 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; 060 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; 040 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; 100 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; P &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt; SAZ4A &lt;/td&gt;
                    &lt;td&gt; 051 &lt;/td&gt;
                    &lt;td&gt; 025 &lt;/td&gt;
                    &lt;td&gt; 076 &lt;/td&gt;
                    &lt;td&gt; P &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td id=&quot;m&quot;&gt; SAZ4B &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; 045 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; 025 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; 070 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; P &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt; SAZ4C &lt;/td&gt;
                    &lt;td&gt; 039 &lt;/td&gt;
                    &lt;td&gt; 024 &lt;/td&gt;
                    &lt;td&gt; 063 &lt;/td&gt;
                    &lt;td&gt; P &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td id=&quot;m&quot;&gt; SAZ4A &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; 040 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; 023 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; 063 &lt;/td&gt;
                    &lt;td id=&quot;m&quot;&gt; P &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr&gt;
                    &lt;td&gt; TSSEE &lt;/td&gt;
                    &lt;td&gt; 030 &lt;/td&gt;
                    &lt;td&gt; 030 &lt;/td&gt;
                    &lt;td&gt; 060 &lt;/td&gt;
                    &lt;td&gt; P &lt;/td&gt;
                &lt;/tr&gt;
               &lt;/table&gt;
               &lt;span&gt;
                &lt;b&gt; AAA-Absent | P-PASS | F-FAIL | RA - Re-Appear (from 2019-2020 Batch)&lt;/b&gt;
               &lt;/span&gt;

        &lt;/div&gt;    
    &lt;/div&gt;

    &lt;/body&gt;
    &lt;/html&gt;

&lt;/textarea&gt;

&lt;br&gt;&lt;br&gt;  
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/5738466222170799498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/12/marksheet-design-sample-in-html-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/5738466222170799498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/5738466222170799498'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/12/marksheet-design-sample-in-html-code.html' title='Marksheet design sample in html code responsive one'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEifL6zy_eihHkZtM1iOBtT8RMEAwJseRXXzGl2QGAjlYMOVi7w62e9BtzWCVq682ShUddT_hMOhSSNxhtmcj6uv32fUoTMhyznIpS04JTcshgNQ4brH9HZofu1FBN-H0BWf6ZQoqngM7OaSIpsvbpystDW1mp8rYgUCJgGw0IvidN_ekpJ5w5BXNvb_qg=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-7412723522396260539</id><published>2021-11-24T07:22:00.007+05:30</published><updated>2022-02-28T18:52:18.070+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Google Kick Start Round H 2021 problem"/><title type='text'>Round H Google Kick Start 2021 Transform the String Problem Solved in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjUV5BcwO3WT6KOCrJvlfPb8lAqmBF-KSNyzDATx2tsdMAbKo9tTBMLT4VI332pvTxpm627GPdCSsZ211ffCL64NwNtFjJULs4G47L1YDiewCYEM5mQ_zgNga1kh-sYUAHnMeWSjGPvjlPkHallEXEzhe5BE7QDdXjigpdbJA9hvUa_6YKG3IT1S-S2Ng=s568&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;238&quot; data-original-width=&quot;568&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjUV5BcwO3WT6KOCrJvlfPb8lAqmBF-KSNyzDATx2tsdMAbKo9tTBMLT4VI332pvTxpm627GPdCSsZ211ffCL64NwNtFjJULs4G47L1YDiewCYEM5mQ_zgNga1kh-sYUAHnMeWSjGPvjlPkHallEXEzhe5BE7QDdXjigpdbJA9hvUa_6YKG3IT1S-S2Ng=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;  
  
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
You are given a string S which denotes a padlock consisting of lower case English letters. You are also given a string F consisting of set of favorite lower case English letters. You are allowed to perform several operations on the padlock. In each operation, you can change one letter of the string to the one following it or preceding it in the alphabetical order. For example: for the letter c, you are allowed to change it to either b or d in an operation. The letters can be considered in a cyclic order, i.e., the preceding letter for letter a would be letter z. Similarly, the following letter for letter z would be letter a.
&lt;br/&gt;&lt;br/&gt;
Your aim is to find the minimum number of operations that are required such that each letter in string S after applying the operations, is present in string F.
&lt;br&gt;&lt;br&gt;  
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow.
&lt;br/&gt;
Each test case consists of two lines.
&lt;br/&gt;
The first line of each test case contains the string S.
&lt;br&gt;
The second line of each test case contains the string F.
&lt;br&gt;&lt;br&gt;  

&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;  
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the minimum number of operations that are required such that each letter in string S after applying the operations, is one of the characters in string F.  
&lt;br/&gt;&lt;br/&gt;

&lt;a id=&quot;head&quot;&gt;Limits&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Memory limit: 1 GB.&lt;br/&gt;
1≤T≤100.&lt;br/&gt;
1≤ the length of S≤105.&lt;br/&gt;
S only consists of lower case English letters.&lt;br/&gt;
F only consists of distinct lower case English letters.&lt;br/&gt;
The letters in string F are lexicographically sorted.
           
&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 20 seconds.&lt;br/&gt;
The length of F=1.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 40 seconds.&lt;br/&gt;
1≤ the length of F≤26.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Sample&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEimtjLC_87WJzpk7OfzRDBefZODOam6cRLDfKhjaQVdygVyuAT7vZST7KW0_RfPYK16ZlKKXdnI_Cnpa2vpvjpKlY9GujXaaYJ6lIB5Kp8X1xluDQuiiF2rpqrfsUazCJt-AwC7EsYXvB_KFZvjcGFutRYKGKS48n53YFnLPaBG4HT6IAgQl0mBd0wl_w=s554&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;189&quot; data-original-width=&quot;554&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEimtjLC_87WJzpk7OfzRDBefZODOam6cRLDfKhjaQVdygVyuAT7vZST7KW0_RfPYK16ZlKKXdnI_Cnpa2vpvjpKlY9GujXaaYJ6lIB5Kp8X1xluDQuiiF2rpqrfsUazCJt-AwC7EsYXvB_KFZvjcGFutRYKGKS48n53YFnLPaBG4HT6IAgQl0mBd0wl_w=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;


In Sample Case #1, all the letters in string S should be converted to either the letter o or the letter u. For the first and second letters it is optimal to change them to preceding letters till they are changed to letter o. The first letter would take 1 operation to change to letter o. The second letter would take 2 operations to change to letter o. For fourth and fifth letters it is optimal to change them to following letters till they are changed to letter u. The fourth letter would take 2 operations to change to letter u. The fifth letter would take 1 operation to change to letter u. We can change the third letter to either o or u as both of them would require 3 operations. Hence, we need a total of 9 operations to change string S such that all letters are changed to either o or u.
&lt;br&gt;&lt;br&gt;
In Sample Case #2, string S already contains only the favorite letters from string F. Hence, we do not require any more operations.
&lt;br/&gt;&lt;br/&gt;
In Sample Case #3, we only need to change the last letter b to either a or c. Thus, we only need 1 operation.
&lt;br&gt;&lt;br&gt;  
 
Click the link to see more details about this problem. &lt;a href=&quot;https://codingcompetitions.withgoogle.com/kickstart/round/0000000000435914/00000000008da461&quot;&gt;Google Kick Start Round H 2021 Transform the String.&lt;/a&gt; 
&lt;br&gt;&lt;br&gt;    

&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;   
  
&lt;br&gt;  
&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:115vh;&quot;&gt;

      import java.util.Arrays;
      import java.util.Scanner;

      public class Solution {

          public static void main(String[] args) {

              Scanner sc = new Scanner(System.in);
              int t = sc.nextInt();
  
              for(int i=0; i&lt;t; i++) {

                  String s = sc.next();
                  char[] c = s.toCharArray();
                  String s1 = sc.next();
                  char[] c1 = s1.toCharArray();
                                
                  int [] a = new int[s.length()];
                  Arrays.fill(a, 0);
                  int k1[] = new int[s.length()];
                  Arrays.fill(k1, Integer.MAX_VALUE);
                                
                  int count = 0;

                  for(int j=0; j&lt;s1.length(); j++) {
                      for(int k=0; k&lt;s.length(); k++){
                          int fav = c1[j];
                          int str = c[k];
                          int one_way=0, two_way=0;
                          if(fav &gt; str) {
                              one_way = Math.abs(fav - str);
                              int aa = str - 96;
                              int zz = 122 - fav;
                              two_way = aa + zz;
                          }
                          else {
                              one_way = Math.abs(str - fav);
                              int zz = 122 - str;
                              int aa = fav - 96;
                              two_way = zz + aa;
                          }

                          if(k1[k] &gt; Math.min(one_way, two_way)) {
                          a[k] = Math.min(one_way, two_way);
                          k1[k] = a[k];
                          }

                      }
                  }

                  for(int m=0; m&lt;s.length(); m++) {
                      count += a[m];
                  }
                                             
                  System.out.printf(&quot;Case #%d: %d\n&quot;,i+1,count);
              }

          }

      }

&lt;/textarea&gt;

&lt;br&gt;&lt;br&gt;  
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/7412723522396260539/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/11/round-h-google-kick-start-2021.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/7412723522396260539'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/7412723522396260539'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/11/round-h-google-kick-start-2021.html' title='Round H Google Kick Start 2021 Transform the String Problem Solved in Java'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEjUV5BcwO3WT6KOCrJvlfPb8lAqmBF-KSNyzDATx2tsdMAbKo9tTBMLT4VI332pvTxpm627GPdCSsZ211ffCL64NwNtFjJULs4G47L1YDiewCYEM5mQ_zgNga1kh-sYUAHnMeWSjGPvjlPkHallEXEzhe5BE7QDdXjigpdbJA9hvUa_6YKG3IT1S-S2Ng=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-8283243588147071916</id><published>2021-11-11T21:27:00.007+05:30</published><updated>2022-02-28T18:58:48.268+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Django framework password generator"/><category scheme="http://www.blogger.com/atom/ns#" term="python django framework from scratch"/><title type='text'>Python Django Random password generator from scratch.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
  
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Django&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
Django is one of the most popular frameworks used to create or build web applications with python. Without further ado let&#39;s create a password generator in django with user signup, login and logout option and a result page to show that user has already logged in.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Pre-requisite&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
Make sure you have the latest version of python, Go with any IDE you are familiar with.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Installing Virtual Environment and Django Project&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
Open your terminal and run these commands to Install required Packages:&lt;br&gt;
1. pip install pipenv&lt;br&gt;
2. cd (folder name) - get into the folder where you want your django project to be present, then run&lt;br&gt;
3. pipenv install django&lt;br&gt;
4. pipenv shell&lt;br&gt;
5. django-admin startproject (project name)&lt;br&gt;
6. pipenv --venv - copy and paste this path with python interpreter path and add (\bin\python) to it.&lt;br&gt;
7. python manage.py startapp (app name) - whenever an app is started, the app name has to be mentioned in Settings.py under Installed Apps.
&lt;br&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgJgcErl4H1VEJycXHlJmCQ7XMxVZbs05MisUKaQC6LZqEqkzzggUiYcWqSsPYE3SZMQTdvm-SvR6LLI-i-rgNn-JnLYNqw4nTU2nvCUNDpUt2VkEQym9jYGarB2UYabfbYMjqTidOzyz7s9Pgzd7uWzeh0pEwk0VnGs_GWvw03pXHNk73dBlm34icIrw=s348&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;268&quot; data-original-width=&quot;348&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgJgcErl4H1VEJycXHlJmCQ7XMxVZbs05MisUKaQC6LZqEqkzzggUiYcWqSsPYE3SZMQTdvm-SvR6LLI-i-rgNn-JnLYNqw4nTU2nvCUNDpUt2VkEQym9jYGarB2UYabfbYMjqTidOzyz7s9Pgzd7uWzeh0pEwk0VnGs_GWvw03pXHNk73dBlm34icIrw=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
8. python manage.py createsuperuser - which is to get login details for admin(username, email, password and confirm password) now Admin module can be logged in. Note: By default Django provides Admin module and its features.&lt;br&gt;
9. python manage.py makemigrations&lt;br&gt;
10. python manage.py migrate&lt;br&gt;
11. python manage.py runserver - click the url shown in terminal use ctrl + click (now you can see the page with successfully installed in your web browser)
  
&lt;br/&gt;&lt;br/&gt;  
&lt;a id=&quot;head&quot;&gt;Project Folder&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
After adding some files and folders your directory looks something like this
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjqZZzK7Plusyt_do7jlR7_BDQhYVMKTFlE8xkIW7S97683ObabI1HJNMiPXHzr_jAB_7XtY2Kft2wCTw0-DeYt96CV53oYAWLojSX_36JCdZRfDSy_qi0t8jnikZI7Xu0PWrJNY70eyZDqKoXrdOdc9ffS9pOkc4CFOXz2YHZOamSHSxorqBFhGR3lSA&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; data-original-height=&quot;596&quot; data-original-width=&quot;323&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjqZZzK7Plusyt_do7jlR7_BDQhYVMKTFlE8xkIW7S97683ObabI1HJNMiPXHzr_jAB_7XtY2Kft2wCTw0-DeYt96CV53oYAWLojSX_36JCdZRfDSy_qi0t8jnikZI7Xu0PWrJNY70eyZDqKoXrdOdc9ffS9pOkc4CFOXz2YHZOamSHSxorqBFhGR3lSA&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
Folder and Files to be added in your app:&lt;br&gt;&lt;br&gt;
1. template folder and required html files.&lt;br&gt;
2. forms.py - to use default form provided by django.&lt;br&gt;
3. decorators.py - to authenticate whether the user is already logged in or not.&lt;br&gt;
4. urls.py - to redirect pages according to url.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Template&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
Firstly let me explain how a web application works. Redirecting from one page to another in a site won&#39;t change the template every time only the body of the content is going to change, similarly we are also going to use the same template for every page.
&lt;br&gt;&lt;br&gt;  
&lt;textarea  wrap=&quot;off&quot; style=&quot;height:140vh;&quot;&gt;


      &lt;!DOCTYPE html&gt;
      &lt;html lang=&quot;en&quot;&gt;
      &lt;head&gt;
          &lt;meta charset=&quot;UTF-8&quot;&gt;
          &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
          &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
          &lt;title&gt;Python Password Generator&lt;/title&gt;
          &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot;&gt;
          &lt;!-- &lt;link rel=&quot;stylesheet&quot; href=&quot;GFG.css&quot;/&gt; --&gt;
          &lt;style&gt;
              *{
                  background-color: white;
                  transition: all .20s ease;
                  height: auto;
                  width: auto;
              }

              #content{
                  color:red;
                  text-align:center;
                  font-family:FontAwesome;
                  font-weight:bold;
                  margin-top:3vh;
                  font-size:2vw;
              }

              #top-nav-bar{
                  border-bottom:1px solid red;
                  border-top:1px solid red;
                  padding: 10px;
                  text-align: center;
                  font-family:FontAwesome;
                  font-weight:400;
                  font-size:12px;
                  width: 100%;
                  display: flex;
                  height: auto;
                  box-sizing: border-box;
                  position: relative;
                  margin: 0 auto;
                  overflow: visible;
                  justify-content: space-between;
                  z-index: 10;
              }

              #web-name{
                  float:left;
                  padding-left: 5%;
                  font-size:16px;
                  display: block;
                  font-family: Arial;
              }
              #main-menu{
                  float: right;
                  padding-left:5%;
                  display: block;
                  font-family: Arial;
              }

              a{
                  padding-left: 25px;
                  text-decoration: none;
                  color: black;
                  font-weight: bold;
              }
              a:hover{
                  color: red;
              }
              li{
                  display: inline-block;
              }
              #mob-nav-open, #mob-nav-close{
                  top:20px;
                  right: 10px;
                  position: absolute;
                  padding:0 0 0 20px;
                  display: none;
                  transition: 2s;
              }

              @media  screen and (max-width:850px){

                  #web-name{
                      padding-left: 0px;
                  }
                  #main-menu{
                      display:none;
                  }
                  #mob-nav-open{
                      display: block;
                  }
                  #top-nav-bar{
                      display: block;
                  }
                  #top-nav-bar{
                      flex-direction: column;
                      align-items: flex-start;
                      display: flex;

                  }
                  #main-menu{
                      width: 100%;
                      height: 100%;
                      transition: 1s ease;
                      z-index: 20;
                      text-align: left;
                  }
                  li{
                      display:block;
                      padding: 10px;
                      border-top: 1px solid red;
                      font-family: FontAwesome;
                      font-size: 12px;
                      font-weight: bold;
                  }
                  li &gt; a{
                      display: inline-block;
                      width: 98%;
                  }
              }

          &lt;/style&gt;   
          &lt;!-- &lt;script src=&quot;GFG.js&quot;&gt;&lt;/script&gt; --&gt;
          &lt;script&gt;
              // DISPLAY TOP MOBILE NAVIGATION
          // HIDE TOP MOBILE NAVIGATION TOGGLE
      function mobnav(){
          var a = document.getElementById(&quot;main-menu&quot;);
          var open = document.getElementById(&quot;mob-nav-open&quot;);
          var close = document.getElementById(&quot;mob-nav-close&quot;);
          open.style.display =&quot;none&quot;;
          close.style.display =&quot;block&quot;;
          if(a.style.display === &quot;block&quot;){
              a.style.display = &quot;none&quot;;
          }
          else{
          a.style.display = &#39;block&#39;;
          }
      }
          // OPEN TOP MOBILE NAVIGATION TOGGLE
      function mobnavclose(){
          var a = document.getElementById(&quot;main-menu&quot;);
          var open = document.getElementById(&quot;mob-nav-open&quot;);
          var close = document.getElementById(&quot;mob-nav-close&quot;);
          open.style.display = &quot;&quot;;
          close.style.display = &quot;none&quot;;
          a.style.display = &quot;&quot;;
      }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body &gt;
      &lt;div class=&quot;container&quot;&gt;
          &lt;!-- TOP NAVIGATION BAR     --&gt;
          &lt;div class=&quot;top-nav-bar&quot; id=&quot;top-nav-bar&quot;&gt;
              &lt;!-- WEBSITE NAME OR LOGO --&gt;
              &lt;div class=&quot;web-name&quot; id=&quot;web-name&quot; title=&quot;website&quot;&gt;
                 &lt;a href=&quot;home&quot;&gt;PASSWORD GENERATOR&lt;/a&gt; &lt;br&gt;
                 &lt;a style=&quot;color: blue; font-size: 10px;&quot;&gt;Python Password Generator&lt;/a&gt; 
              &lt;/div&gt;
              &lt;!-- MAIN MENU --&gt;
              &lt;ul class=&quot;main-menu&quot; id=&quot;main-menu&quot; title=&quot;main menu&quot;&gt;
                  &lt;li&gt;&lt;a href=&quot;admin&quot; title=&quot;admin login&quot;&gt;ADMIN&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href=&quot;home&quot; title=&quot;home&quot;&gt;HOME&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href=&quot;result&quot; title=&quot;result&quot;&gt;RESULT&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href=&quot;register&quot; title=&quot;register&quot;&gt;SIGNUP&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href=&quot;login_page&quot; title=&quot;login&quot;&gt;LOGIN&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href=&quot;logout_user&quot; title=&quot;logout&quot;&gt;LOGOUT&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;

              &lt;a href=&quot;javascript:void(0);&quot; id=&quot;mob-nav-open&quot; class=&quot;icon&quot; onclick=&quot;mobnav()&quot;&gt;
              &lt;i class=&quot;fa fa-bars fa-lg&quot;&gt;&lt;/i&gt;
              &lt;/a&gt;
              &lt;a href=&quot;javascript:void(0);&quot; id=&quot;mob-nav-close&quot; class=&quot;icon&quot; onclick=&quot;mobnavclose()&quot;&gt;
                  &lt;i class=&quot;fas fa-times fa-lg&quot;&gt;&lt;/i&gt;
                  &lt;/a&gt;
          &lt;/div&gt; 


          &lt;!-- Main Content --&gt;
          &lt;div id=&quot;content&quot;&gt;
              {% block content %}
          &lt;!-- Html files linked with this page will be shown here. 
			   Scroll down to know how other pages are linked to this page. --&gt;    
              {% endblock %}
              &lt;/div&gt;    
      &lt;/div&gt;

      &lt;/body&gt;
      &lt;/html&gt;
                                      
&lt;/textarea&gt;  
&lt;br&gt;&lt;br&gt;  
Template contains only a basic responsive main-menu and it&#39;s a simple one created using html,css and js. Instead of using Internal Css and Js you also can use external files and you also can go with bootstrap instead of using css and js in django.
&lt;br/&gt;&lt;br/&gt;
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;    
  
&lt;br&gt;  
&lt;a id=&quot;head&quot;&gt;Random Password Generator&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
A simple html form that contains a button to generate a random password, once the password is generated that will be displayed in the same page within a textbox and the generated password is copied to the user&#39;s clipboard done by using python&#39;s pandas library. This html form has to be linked with the above template.
&lt;br&gt;&lt;br&gt;
&lt;a id=&quot;head&quot;&gt;Css&lt;/a&gt;&lt;br/&gt;&lt;br&gt; 
This is going to be the Cascading style sheet for all of our html files except template.
&lt;br&gt;&lt;br&gt;  
&lt;textarea  wrap=&quot;off&quot; style=&quot;height:140vh;&quot;&gt;

              *{
                  color: red;
              }
              #head{
                color:black;
                text-align: left;
              }
              #form_head{
                color:blue;
                align-items: center;
              }

                  textarea {
                  width: calc(100% - 12px);
                  padding: 5px;
                  }
                  form {
                  padding: 20px;
                  border-radius: 6px;
                  background: #fff;
                  box-shadow: 0 0 8px  #669999; 
                  flex: 1;
                  margin: 20%;
                  margin-top: 0%;
                  }

                  #log_in{
                  flex-direction:column;
                  }
                  #log_in input{
                    width: 200%
                  }

                  input, select, textarea {
                  margin-bottom: 10px;
                  border: 1px solid #ccc;
                  border-radius: 3px;
                  }
                  input {
                  width: calc(100% - 10px);
                  padding: 5px;
                  }
                  input[type=&quot;date&quot;] {
                  padding: 4px 5px;
                  }
                  textarea {
                  width: calc(100% - 12px);
                  padding: 5px;
                  }
                  label{
                    float: left;
                    color: black;
                    margin-left: 0px;
                  }
                  span{
                    color:red;
                  }
                  .item:hover p, .item:hover i, .question:hover p, .question label:hover, input:hover::placeholder {
                  color:  #669999;
                  }
                  .item input:hover, .item select:hover, .item textarea:hover {
                  border: 1px solid transparent;
                  box-shadow: 0 0 3px 0  #669999;
                  color: #669999;
                  }
                  .item {
                  position: relative;
                  margin: 10px 0;
                  }
                  .item span {
                  color: red;
                  }
                  .colums {
                  display:flex;
                  justify-content:space-between;
                  flex-direction:row;
                  flex-wrap:wrap;
                  }
                  .colums div {
                  width:48%;
                  }

                  input[type=&quot;date&quot;]::-webkit-inner-spin-button {
                  display: none;
                  }
                  .item i, input[type=&quot;date&quot;]::-webkit-calendar-picker-indicator {
                  position: absolute;
                  font-size: 20px;
                  color:  #a3c2c2;
                  }
                  .item i {
                  right: 1%;
                  top: 30px;
                  z-index: 1;
                  }
              .btn-block {
                  margin-top: 10px;
                  text-align: center;
                  align-items: center;
                  }
                  button {
                  width: 100px;
                  padding: 10px;
                  border: none;
                  border-radius: 5px; 
                  background:  grey;
                  font-size: 16px;
                  color: white;
                  cursor: pointer;
                  }
                  button:hover {
                  background:  black;
                  }
                  #messages{
                    color: green;
                    font-weight: bold;
                    font-size: 100%;
                  }
  
&lt;/textarea&gt;    
&lt;br&gt;&lt;br&gt;  
&lt;a id=&quot;head&quot;&gt;home.html&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
&lt;textarea  wrap=&quot;off&quot; style=&quot;height:128vh;&quot;&gt;
  
      {% extends  &#39;temp.html&#39; %} 
	  &lt;!-- As of mentioned above, this home.html is extended to our template file --&gt;
      {% block content %}  
  
      &lt;html&gt;
      &lt;head&gt;
      &lt;!-- Link style sheet here --&gt;  
      &lt;/head&gt;  
      &lt;body&gt;  

        &lt;h3 id=&quot;head&quot;&gt;Generate Password&lt;/h3&gt;

      &lt;!-- To show a one time message for user also known as flash message --&gt;  
      {% for message in messages %}
        &lt;p id=&quot;messages&quot;&gt;{{message}}&lt;/p&gt;
      {% endfor %}

          &lt;form action=&quot;generate&quot; method=&quot;post&quot; id=&quot;login&quot;&gt;
              {% csrf_token %}
              &lt;!-- It is necessary to add csrf token in a form for current user session or 
				   we can say it to protect the data submitted through this form --&gt;

              &lt;h3 id=&quot;form_head&quot;&gt;Click the Button to Generate Random Password&lt;/h3&gt;

              &lt;div class=&quot;colums&quot; id=&quot;log_in&quot;&gt;
                &lt;div class=&quot;item&quot;&gt;
                  &lt;label for=&quot;password&quot;&gt;Password&lt;/label&gt;
                  &lt;input id=&quot;password&quot; type=&quot;text&quot;  name=&quot;password&quot; value=&quot;{{password}}&quot;&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class=&quot;btn-block&quot;&gt;
                &lt;button type=&quot;submit&quot; name=&quot;generate&quot;&gt;Generate&lt;/button&gt;
              &lt;/div&gt;

              &lt;/form&gt;

      &lt;/body&gt;
      &lt;/html&gt;

      {% endblock %}  
  
&lt;/textarea&gt;  
&lt;br/&gt;&lt;br&gt;
&lt;a id=&quot;head&quot;&gt;urls.py&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Function views&lt;br/&gt;
    1. Add an import:  from my_app import views&lt;br/&gt;
    2. Add a URL to urlpatterns:  path(&#39;&#39;, views.home, name=&#39;home&#39;)&lt;br/&gt;
Class-based views&lt;br/&gt;
    1. Add an import:  from other_app.views import Home&lt;br/&gt;
    2. Add a URL to urlpatterns:  path(&#39;&#39;, Home.as_view(), name=&#39;home&#39;)&lt;br/&gt;
Including another URLconf&lt;br/&gt;
    1. Import the include() function: from django.urls import include, path&lt;br/&gt;
    2. Add a URL to urlpatterns:  path(&#39;blog/&#39;, include(&#39;blog.urls&#39;))&lt;br/&gt;&lt;br/&gt;

You can see the above instruction in the auto created urls.py file. Add another URL configuration using include as mentioned above:
&lt;br&gt;&lt;br&gt;  
&lt;textarea  wrap=&quot;off&quot; style=&quot;height:40vh;&quot;&gt;
  
      from django.contrib import admin
      from django.urls import path, include

      urlpatterns = [
          path(&#39;admin/&#39;, admin.site.urls), 
  		  # Redirect to default admin module and all it features provided by django.
          path(&#39;&#39;,include(&#39;generator.urls&#39;)), 
  		  # Redirecting path to another URL configuration module.
      ]
  
&lt;/textarea&gt;    
&lt;br&gt;&lt;br&gt;  
&lt;a id=&quot;head&quot;&gt;urls.py (app)&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
&lt;textarea  wrap=&quot;off&quot; style=&quot;height:40vh;&quot;&gt;
  
      from django.urls import path
      from django.urls.resolvers import URLPattern
      from . import views

      urlpatterns = [
          path(&#39;&#39;,views.home,name=&quot;home&quot;),
          path(&#39;home&#39;,views.home), 
  		  # As mentioned above call views.home for both default and home.
  	  ]	
  
&lt;/textarea&gt;    
&lt;br&gt;&lt;br&gt;  
&lt;a id=&quot;head&quot;&gt;views.py (app)&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
&lt;textarea  wrap=&quot;off&quot; style=&quot;height:120vh;&quot;&gt;
  
      from django.shortcuts import render, redirect
      from django.contrib import messages
      import string
      from random import *
      import pandas as pd

      def home(request):
          context={
              &#39;password&#39;:&quot;&quot;
          }
          return render(request,&#39;home.html&#39;,context)

      def generate(request):
          Tamil_Number = u&quot;௦௧௨௩௪௫௬௭௮௯௰௱௲&quot;
          Number = string.digits
          Character = string.ascii_letters
          Tamil_Character = u&quot;ஃஅஆஇஈஉஊஎஏஐஓஔ&quot;
          Symbol = string.punctuation

          Numbers = Tamil_Number + Number
          Characters = Tamil_Character + Character
          Strong_Password = Numbers + Characters + Symbol

          characters = Strong_Password
          password = &quot;&quot;.join(choice(characters) for x in range(randrange(17, 18)))
          context={
              &#39;password&#39;:password
          }

          df = pd.DataFrame([password])
          df.to_clipboard(index=False, header=False)
          messages.success(request,&quot;Password copied to your Clipboard&quot;)
          return render(request,&#39;home.html&#39;,context) 

&lt;/textarea&gt;  
&lt;br&gt;&lt;br&gt;
Password comprises English Alphabets, Numbers(0 to 9), Symbols, Tamil Numbers and some Tamil letters. Once the Random Password is generated the password is copied to the user&#39;s clipboard with the help of pandas library before returning the rendered HttpResponse to the user.
&lt;br&gt;&lt;br&gt; 
&lt;span style=&quot;color:blue&quot;&gt;  
If anyone wants me to continue login, signup, logout and how to access Admin panel in django options for this password generator let me know through comment section guys. Anyway thanks for reading.   
&lt;/span&gt;  
&lt;br&gt;&lt;br&gt;  
  
&lt;a href=&quot;https://www.knowsabouts.in/2020/07/mark-sheet-result-page-using-html-and.html&quot;&gt;Here is the link for Mark Sheet Result page using Html and Css.&lt;/a&gt;  
&lt;br&gt;&lt;br&gt;  
&lt;a href=&quot;https://www.knowsabouts.in/2020/05/draw-scale-using-java-paint-method.html&quot;&gt;Here is the link for Draw Scale using Java Paint&lt;/a&gt;  
&lt;br /&gt;&lt;br/&gt;  
&lt;a href=&quot;https://www.knowsabouts.in/2020/12/how-to-read-multiple-integer-input-in.html&quot;&gt;How to read multiple Integer input in a single line ? and Android Studio Getting Thumbnail to a Video using Glide in a Recyclerview&lt;/a&gt;    
&lt;br /&gt;&lt;br/&gt; 
&lt;a href=&quot;https://www.knowsabouts.in/2021/09/image-processing-in-java-read-write-to.html&quot;&gt;Image Processing in Java - Read, Write, to Black and White, to Gray, to Negative and Bit-Plane Slicing.&lt;/a&gt;  
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://www.knowsabouts.in/2020/02/simple-java-programs-prime-numbers.html&quot;&gt;Write a Java code to check whether a number is prime or not with n root time complexity.&lt;/a&gt;  
&lt;br&gt;&lt;br&gt;    
&lt;a href=&quot;https://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html&quot;&gt;Here is the link for Google KickStart Round F 2021 Trash Bins Problem.&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/8283243588147071916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/11/python-django-random-password-generator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/8283243588147071916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/8283243588147071916'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/11/python-django-random-password-generator.html' title='Python Django Random password generator from scratch.'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgJgcErl4H1VEJycXHlJmCQ7XMxVZbs05MisUKaQC6LZqEqkzzggUiYcWqSsPYE3SZMQTdvm-SvR6LLI-i-rgNn-JnLYNqw4nTU2nvCUNDpUt2VkEQym9jYGarB2UYabfbYMjqTidOzyz7s9Pgzd7uWzeh0pEwk0VnGs_GWvw03pXHNk73dBlm34icIrw=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-3632262018825736692</id><published>2021-10-17T02:23:00.004+05:30</published><updated>2021-10-17T15:19:01.920+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="java dynamic problem"/><category scheme="http://www.blogger.com/atom/ns#" term="Round G 2021 kick start"/><category scheme="http://www.blogger.com/atom/ns#" term="Staying Hydrated Problem"/><title type='text'>Round G 2021 Google Kick Start Staying Hydrated Problem | Java | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhln9m9-gFHXLymeCU3CuREoWALydIjDm5m6b4O58qguIjFIrxWrNhR-5XsHgWzcDZxXyNdMdXgmL1RucC_0QJJKf_MeDE2qMTE13k0oaBYRY6a-eJX3lO-xkDOd9adRcE9kydASr8C5d59jT3KwALbSjY6mMMwIeP4zf9h4-lugwAC0Ji8JwcPHWpSew=s362&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;251&quot; data-original-width=&quot;362&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhln9m9-gFHXLymeCU3CuREoWALydIjDm5m6b4O58qguIjFIrxWrNhR-5XsHgWzcDZxXyNdMdXgmL1RucC_0QJJKf_MeDE2qMTE13k0oaBYRY6a-eJX3lO-xkDOd9adRcE9kydASr8C5d59jT3KwALbSjY6mMMwIeP4zf9h4-lugwAC0Ji8JwcPHWpSew=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
With online classes in full swing, it is important for Grace to take breaks and keep herself hydrated at all times. She has decided to place a water bottle in her room in the most convenient place. This means that the position of this water bottle should be close to all the places in the room where she generally hangs out like the study desk, bed and coffee table among other places.
&lt;br/&gt;&lt;br/&gt;
The room is represented in the form of a coordinate plane. The number of steps Grace needs to go from Point A to Point B is equal to the Manhattan distance between the 2 points. This means, Grace can only walk parallel to the axes of the coordinate plane and with each step, she can move one unit in either of the four directions.
&lt;br/&gt;&lt;br/&gt;
Can you help her find a position in the room to keep the bottle, such that the sum of steps from the bottle to all her favourite furniture pieces will be minimum?
&lt;br/&gt;&lt;br/&gt;
  
Notes: 
&lt;br&gt;  
All the furniture (like study desk, bed, or coffee table) can be represented as rectangles of non-zero area in the plane with edges parallel to the axes.
&lt;br/&gt;&lt;br/&gt;
It is possible for furniture pieces to overlap, as she likes to work on her bed-table too.
&lt;br&gt;&lt;br&gt;  
Assume that Grace can simply pass through the furniture while walking and does not need to go around them.
&lt;br&gt;&lt;br&gt;  
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow.
&lt;br/&gt;
The first line of each test case contains an integer K which represents the number of objects in Grace&#39;s room.
&lt;br/&gt;
K lines follow, each of them describing one object. The i-th line contains four integers, xi,1, yi,1, xi,2, yi,2, where (xi,1, yi,1) represents coordinates of the bottom left corner and (xi,2, yi,2) represents coordinates of the top right corner of the i-th rectangular object.
&lt;br&gt;&lt;br&gt;  

&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;  
For each test case, output one line containing Case #i: x y, where i is the test case number (starting from 1) and x and y are coordinates of the water bottle such that the sum of steps from these coordinates to all the furniture pieces will be minimum.
&lt;br&gt; 
Note, the bottle can lie on the floor or on top of any furniture but should be placed on integer coordinates only.
&lt;br&gt;
If multiple solutions exist, output the one with minimum x coordinate, if multiple solutions have the same x coordinate output the one with minimum y coordinate.  
&lt;br/&gt;&lt;br/&gt;

&lt;a id=&quot;head&quot;&gt;Limits&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Memory limit: 1 GB.&lt;br/&gt;
1≤T≤100.&lt;br/&gt;
xi,1&lt;xi,2, for all i.&lt;br/&gt;
yi,1&lt;yi,2, for all i.
           
&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 40 seconds.&lt;br/&gt;
1≤K≤20.&lt;br/&gt;
−100≤xi,1,xi,2,yi,1,yi,2≤100, for all i.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 90 seconds.&lt;br/&gt;
1≤K≤105&lt;br/&gt;
−109≤xi,1,xi,2,yi,1,yi,2≤109, for all i.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Sample&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgfNSbfImKJivB2i_Zo1cJvDEWgaXtLr90GH4Dyyvv9DpyOLARf22c3HkxQyQUw2VRbzZHBuXuH8UMKc1Owhi-mNa457hSo0WQOjjRN6Dhq8keznbfzD5caNyibqam9vTylC0WGTeCI-bJLY0rrw78jitNJb_6A0ARNg37OOLeFdQTWZfI_r6DSXFmeSw=s518&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;223&quot; data-original-width=&quot;518&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgfNSbfImKJivB2i_Zo1cJvDEWgaXtLr90GH4Dyyvv9DpyOLARf22c3HkxQyQUw2VRbzZHBuXuH8UMKc1Owhi-mNa457hSo0WQOjjRN6Dhq8keznbfzD5caNyibqam9vTylC0WGTeCI-bJLY0rrw78jitNJb_6A0ARNg37OOLeFdQTWZfI_r6DSXFmeSw=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;


&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgxkkNC-b-SRpNuvUJv6k79tdywjFVBllIHqo6PVhfxmlmRQQygmCH-5oMOSW12QaOa-Wb6O7yFbMoz9GosQVY4DzZfDsya763DxQWZeB77fcwcX4GDD9GglBj4PBhsJvcu1vqxp034chAlkcGK9xZFKnkA7GYVMipU5z9Mui6juy2hcYJAs0Nwa6rh-Q=s753&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;577&quot; data-original-width=&quot;753&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgxkkNC-b-SRpNuvUJv6k79tdywjFVBllIHqo6PVhfxmlmRQQygmCH-5oMOSW12QaOa-Wb6O7yFbMoz9GosQVY4DzZfDsya763DxQWZeB77fcwcX4GDD9GglBj4PBhsJvcu1vqxp034chAlkcGK9xZFKnkA7GYVMipU5z9Mui6juy2hcYJAs0Nwa6rh-Q=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;  


In Sample Case #1, Grace can place the bottle at coordinates (1, 3). It is at a distance of 2 steps from first object, 1 step from second and 0 steps from the third one which gives us 3 as the minimum possible sum of steps from a point.
&lt;br&gt;&lt;br&gt;
In Sample Case #2, the water bottle can lie anywhere on the object itself but coordinates (0, 0) correspond to the minimum x and y coordinates. 
&lt;br/&gt;&lt;br/&gt;
 
&lt;a href=&quot;https://codingcompetitions.withgoogle.com/kickstart/round/00000000004362d6/00000000008b3771&quot;&gt;Click the link to see more details about this problem. Google Kick Start Round G 2021 Dogs and Cats Problem.&lt;/a&gt; 
&lt;br&gt;&lt;br&gt;  
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt; 
&lt;br/&gt;  

&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:115vh;&quot;&gt;

      import java.util.*;

      public class Solution{
          public static void main(String[] args) {
              Scanner sc = new Scanner(System.in);

              int test = sc.nextInt();
              for(int t=1; t&lt;=test; t++) {

                  int n = sc.nextInt();
                  List&lt;Integer&gt; x = new ArrayList&lt;&gt;();
                  List&lt;Integer&gt; y = new ArrayList&lt;&gt;();

                  for(int i=0; i&lt;n; i++) {
                      x.add(sc.nextInt());
                      y.add(sc.nextInt());
                      x.add(sc.nextInt());
                      y.add(sc.nextInt());
                  }

                  Collections.sort(x);
                  Collections.sort(y);

                  int xmid = x.get(x.size()/2 -1); 
                  int ymid = y.get(y.size()/2 -1);

                  System.out.printf(&quot;Case #%d: %d %d\n&quot;,t,xmid,ymid);
              }
          }
      }
                                                     
&lt;/textarea&gt;
  
&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://codingcompetitions.withgoogle.com/kickstart/round/00000000004362d6/00000000008b3a1c&quot;&gt;Round G 2021 - Kick Start 2021 Editor. Here you can check whether your code satisfies Time and Space Complexity for the above problem.&lt;/a&gt;  

&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html&quot;&gt;Here is the link for Google KickStart Round F 2021 Trash Bins Problem.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/3632262018825736692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/10/round-g-2021-google-kick-start-staying.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/3632262018825736692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/3632262018825736692'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/10/round-g-2021-google-kick-start-staying.html' title='Round G 2021 Google Kick Start Staying Hydrated Problem | Java | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhln9m9-gFHXLymeCU3CuREoWALydIjDm5m6b4O58qguIjFIrxWrNhR-5XsHgWzcDZxXyNdMdXgmL1RucC_0QJJKf_MeDE2qMTE13k0oaBYRY6a-eJX3lO-xkDOd9adRcE9kydASr8C5d59jT3KwALbSjY6mMMwIeP4zf9h4-lugwAC0Ji8JwcPHWpSew=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-3522963264415472344</id><published>2021-10-17T02:01:00.002+05:30</published><updated>2021-10-17T15:20:14.979+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Dogs and Cats Problem"/><category scheme="http://www.blogger.com/atom/ns#" term="java dynamic problem"/><category scheme="http://www.blogger.com/atom/ns#" term="Round G 2021 kick start"/><title type='text'>Round G 2021 Google Kick Start Dogs and Cats Problem | Java | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgs0ix62P4rAptR9Wse0mWg-KB00c0npjPHOJZkglgAyEYbFJsydscpeg4egiXhN0i2mFGMdno209P2v5CKwYbuKOm2jeqUppCtZTAZffoJkrcixdZ0E2a-petEp7LUTDtIC-vlHTRVUslHs7mG6pW6p6nvh1JDUHouryHa-xxzwLWc0Zrl70Dl-N8KUQ=s431&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;303&quot; data-original-width=&quot;431&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgs0ix62P4rAptR9Wse0mWg-KB00c0npjPHOJZkglgAyEYbFJsydscpeg4egiXhN0i2mFGMdno209P2v5CKwYbuKOm2jeqUppCtZTAZffoJkrcixdZ0E2a-petEp7LUTDtIC-vlHTRVUslHs7mG6pW6p6nvh1JDUHouryHa-xxzwLWc0Zrl70Dl-N8KUQ=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
You work for an animal shelter and you are responsible for feeding the animals. You already prepared D portions of dog food and C portions of cat food.
&lt;br/&gt;&lt;br/&gt;
There are a total of N animals waiting in a line, some of which are dogs and others are cats. It might be possible that all the animals in the line are dogs or all the animals are cats. A string S of N characters C and D represents the order of cats and dogs in the line. The i-th character is equal to C if the i-th animal in the line is a cat. Similarly, the i-th character is equal to D if the i-th animal in the line is a dog.
&lt;br/&gt;&lt;br/&gt;
The animals are fed in the order they stay in the line. Each dog eats exactly 1 portion of dog food and similarly each cat eats exactly 1 portion of cat food. Moreover, you have extra portions of cat food. Every time a dog eats food, you bring M extra portions of cat food for cats.
&lt;br/&gt;&lt;br/&gt;
Animals have to be fed in the order they wait in line and an animal can only eat if the animal before it has already eaten. That means that if you run out of dog (or cat) food portions and a dog (or a cat) is about to get fed, the line will not move, as all the animals will wait patiently.
&lt;br/&gt;&lt;br/&gt;
You need to determine if in this scenario all the dogs in the line will be fed. Note that this means that some cats might remain in the line, but worry not, you will eventually feed them later!  
&lt;br&gt;&lt;br&gt;  
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow.
&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is a list of the answers for the Q queries in order, separated by spaces.  
&lt;br/&gt;&lt;br/&gt;
The first line of each test case contains four integers N, D, C, and M: the number of animals, the initial number of dog food portions, the initial number of cat food portions, and the additional portions of cat food that we add after a dog eats a portion of dog food, respectively.  
&lt;br&gt;&lt;br&gt;  
The next line contains a string S of length N representing the arrangement of animals.  
&lt;br&gt;&lt;br&gt;  

&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;  
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is YES if all the dogs will be fed and NO otherwise.
&lt;br&gt;&lt;br&gt;  
  

&lt;a id=&quot;head&quot;&gt;Limits&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Memory limit: 1 GB.&lt;br&gt;
1≤T≤100.&lt;br&gt;
1≤N≤104.&lt;br&gt;
0≤D,C≤106.&lt;br&gt;
S consists of only characters C and D.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 20 seconds.&lt;br&gt;
M=0
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 40 seconds.&lt;br&gt;
0≤M≤106.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Sample&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhXW62RNDbwMQDfED2Ei0FpKTE9ckssRNIVPhd7c3h-teJhwsKOxfBQUxmcIPxTjyO_kPPoCXgjjmPbm6KmAWqbReNgdKBf1cC1tLXcot8eob-X3Bq_7raPuqRNOvfBI5F_asq7LLJFTd7dSqAeEyxfec42K7wUar1g3wU4ABxSG7f2ytd7JPQF7nXqMw=s519&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;218&quot; data-original-width=&quot;519&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhXW62RNDbwMQDfED2Ei0FpKTE9ckssRNIVPhd7c3h-teJhwsKOxfBQUxmcIPxTjyO_kPPoCXgjjmPbm6KmAWqbReNgdKBf1cC1tLXcot8eob-X3Bq_7raPuqRNOvfBI5F_asq7LLJFTd7dSqAeEyxfec42K7wUar1g3wU4ABxSG7f2ytd7JPQF7nXqMw=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  

In Sample Case #1, there are 10 portions of dog food and 4 portions of cat food.
&lt;br&gt;&lt;br&gt;
The first two animals are cats, so after they eat, 2 portions of cat food remain.
&lt;br/&gt;
Then a dog eats one portion of dog food. Now, there are 9 portions of dog food left.
&lt;br/&gt;
Next, a cat eats a portion of cat food, reducing the number of portions of cat food to 1.
&lt;br/&gt;
The last two animals are dogs and they each eat one portion of dog food.
&lt;br/&gt;
So in this case, all the dogs are able to eat.
&lt;br/&gt;&lt;br/&gt;
In Sample Case #2, there are no dogs. Hence, all (zero) dogs will be able to eat trivially.
&lt;br/&gt;&lt;br/&gt;  
In Sample Case #3, the cat before the second dog will not be able to eat because there will not be enough portions of cat food. Hence, the second dog will also not eat.  
&lt;br/&gt;&lt;br/&gt;
 
&lt;a href=&quot;https://codingcompetitions.withgoogle.com/kickstart/round/00000000004362d6/00000000008b3771&quot;&gt;Click the link to see more Sameple Test Cases. Google Kick Start Round G 2021 Dogs and Cats Problem.&lt;/a&gt; 
&lt;br&gt;&lt;br&gt;  
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt; 
&lt;br/&gt;  

&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:160vh;&quot;&gt;

        import java.util.*;
        public class Solution {

            public static void main(String[] args) {

                Scanner sc = new Scanner(System.in);

                int test = sc.nextInt();
                for(int t=1; t&lt;=test; t++) {
                   int n = sc.nextInt();
                   int d = sc.nextInt();
                   long c = sc.nextLong();
                   long m = sc.nextLong();

                   String s = sc.next();
                   char cd[] = s.toCharArray();
                   boolean feed = true;

                   for(int i=0; i&lt;n; i++) {
                       if(cd[i] == &#39;C&#39;) {
                           if(c &lt;= 0) {
                               while(i &lt; n) {
                                   if(cd[i] == &#39;D&#39;) feed = false;
                                   i++;
                               }
                               break;
                           }
                           c--;
                       }
                       if(cd[i] == &#39;D&#39;) {
                           if(d &lt;= 0) {
                               feed = false;
                               break;
                           }
                           d--;
                           c += m;
                       }
                   }

                   System.out.printf(&quot;Case #%d: %s\n&quot;,t,feed == true ? &quot;YES&quot; : &quot;NO&quot;);
                }
            }

        }

&lt;/textarea&gt;
  
&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://codingcompetitions.withgoogle.com/kickstart/round/00000000004362d6/00000000008b3771&quot;&gt;Round G 2021 - Kick Start 2021 Editor. Here you can check whether your code satisfies Time and Space Complexity for the above problem.&lt;/a&gt;  

&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html&quot;&gt;Here is the link for Google KickStart Round F 2021 Trash Bins Problem.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/3522963264415472344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/10/round-g-2021-google-kick-start-dogs-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/3522963264415472344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/3522963264415472344'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/10/round-g-2021-google-kick-start-dogs-and.html' title='Round G 2021 Google Kick Start Dogs and Cats Problem | Java | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgs0ix62P4rAptR9Wse0mWg-KB00c0npjPHOJZkglgAyEYbFJsydscpeg4egiXhN0i2mFGMdno209P2v5CKwYbuKOm2jeqUppCtZTAZffoJkrcixdZ0E2a-petEp7LUTDtIC-vlHTRVUslHs7mG6pW6p6nvh1JDUHouryHa-xxzwLWc0Zrl70Dl-N8KUQ=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-8244261975042148378</id><published>2021-10-12T02:24:00.001+05:30</published><updated>2021-10-12T02:24:06.416+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java Code Kick Start Friends Problem"/><category scheme="http://www.blogger.com/atom/ns#" term="Round H 2020 Kick Start Friends Problem"/><title type='text'>Round H 2020 Google Kick Start Friends Problem - Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s604/Screenshot+%2528363%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;513&quot; data-original-width=&quot;604&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s400/Screenshot+%2528363%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
There are N people in the world numbered 1 to N. The i-th person has a distinct name Si that is a string of uppercase English letters.
&lt;br/&gt;&lt;br/&gt;
Two people are friends if and only if there is some letter that appears at least once in each of their names. Any such letter does not need to be at the same position in both names. After all, friendship requires having something in common!
&lt;br/&gt;&lt;br/&gt;
A friendship chain of length n between person A and person B is a sequence of people X1, X2, ..., Xn such that X1 = A, Xn = B, and Xi and Xi+1 are friends, for i=1 to n-1. Note that any two people can have zero or more friendship chains between them.  
&lt;br/&gt;&lt;br/&gt;
For each of the given Q pairs of people, can you find the length of the shortest friendship chain between them? If there is no friendship chain between a pair, output -1.
&lt;br/&gt;&lt;br/&gt;  
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow. The first line of each test case contains the two integers N and Q. The second line contains N strings, which are people&#39;s names. The i-th string (starting from 1) is Si. Then, Q lines follow, describing the queries. The i-th of these lines contains the two integers Xi and Yi, which are the indexes (counting starting from 1) of a pair of people in the list of names.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is a list of the answers for the Q queries in order, separated by spaces.  
&lt;br/&gt;&lt;br/&gt;  
  

&lt;a id=&quot;head&quot;&gt;Limits&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 40 seconds per test set.
Memory limit: 1GB.
1 ≤ T ≤ 100.
1 ≤ Q ≤ 5 × 104.
Si consists of uppercase English letters, for all i.
1 ≤ length of Si ≤ 20, for all i.
All Si are distinct.
1 ≤ Xi &lt;Yi ≤ N, for all i.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
2 ≤ N ≤ 100.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
103 &lt; N ≤ 5 × 104 in at most 10 cases.
2 ≤ N ≤ 103 in all other cases.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Sample&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh3RcIhLWIylLRR3yF1-C5EHxHAT2-mg70TJKv1HcccQdEJ8xO6sCqQ9Ad_aBzZgKg1Pb-y1pmE3wuPpLm8WgZQO88gR7vS9NcDiEzHOA_n2s9vLxHg1rWQGCRZclc1u3GlhOa4uAkaOqecigkHH_G7iUdCPk-YBLSH8CnuwIE3c8q-MNeb-btp21TduQ=s478&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;297&quot; data-original-width=&quot;478&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh3RcIhLWIylLRR3yF1-C5EHxHAT2-mg70TJKv1HcccQdEJ8xO6sCqQ9Ad_aBzZgKg1Pb-y1pmE3wuPpLm8WgZQO88gR7vS9NcDiEzHOA_n2s9vLxHg1rWQGCRZclc1u3GlhOa4uAkaOqecigkHH_G7iUdCPk-YBLSH8CnuwIE3c8q-MNeb-btp21TduQ=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  

In Sample Case #1, there are two queries:
&lt;br&gt;&lt;br/&gt;
In the first query, LIZZIE and KEVIN are friends (because they share the letter E in their names). So, the shortest friendship chain length is 2.
&lt;br&gt;  
In the second query, LIZZIE and BOHDAN are not friends, but have two possible shortest friendship chains (either via KEVIN or LALIT). So, the shortest friendship chain length is 3. Note that there are other friendship chains as well, but they are longer.
&lt;br&gt;&lt;br&gt;
  
In Sample Case #2, there are two queries:
&lt;br/&gt;&lt;br/&gt;
In the first query, KICK and START are not connected by a chain of friends.
&lt;br/&gt;&lt;br/&gt;  
The second query is the same as the first query. Note that queries are not guaranteed to be distinct.
&lt;br/&gt;  
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt; 
&lt;br/&gt;  

&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:160vh;&quot;&gt;

        import java.util.*;

        public class Solution{

        //	static int INF = 0x3f3f3f3f;
            public static void main(String[] args) {

                Scanner sc= new Scanner(System.in);
                int test = sc.nextInt();
                for(int t=1; t&lt;=test; t++) {
                    int N = sc.nextInt();
                    int Q = sc.nextInt();

                    String S[] = new String[N];
                    for(int i=0; i&lt;N; i++) {
                        S[i] = sc.next();
                    }

                    int d[][] = new int[26][26];

                    for(int[] d1 : d) Arrays.fill(d1, Byte.MAX_VALUE);
        // 			                  Arrays.fill(d1,INF);

                    for(int i=0; i&lt;N; i++) {
                        char c1[] = S[i].toCharArray();
                        char c2[] = S[i].toCharArray();
                        for(int j=0; j&lt;S[i].length(); j++) {
                            for(int k=0; k&lt;S[i].length(); k++) {
                                if(c1[j] != c2[k])
                                    d[c1[j] - &#39;A&#39;][c2[k] - &#39;A&#39;] =1;
                            }
                        }	
                    }

                    for(int k=0; k&lt; 26; ++k)
                        for(int i=0; i &lt; 26; ++i) {
                            if(i == k)
                                continue;
                            for(int j=0; j&lt;26; j++) {
                                if(j ==i || j == k)
                                    continue;
                                d[i][j] = Math.min(d[i][j],d[i][k] + d[k][j]);
                            } 	
                        }   

                    int ans = 0;
                    List&lt;Integer&gt; li = new ArrayList&lt;Integer&gt;();
                    for(int i=1; i&lt;=Q; ++i) {
                        int X = sc.nextInt();
                        int Y = sc.nextInt();
                        ans = Byte.MAX_VALUE; // ans = INF;

                        char c1[] = S[X-1].toCharArray();
                        char c2[] = S[Y-1].toCharArray();
                        boolean found = false;
                        for(int j=0; j&lt;S[X-1].length(); j++) {
                            for(int k=0; k&lt;S[Y-1].length(); k++) {
                                if(c1[j] == c2[k]) {
                                    li.add(2);
                                    found = true;
                                    break;
                                }
                                ans = Math.min(ans, d[c1[j]-&#39;A&#39;][c2[k]-&#39;A&#39;]+2);
                            }
                            if(found) break;
                        }
                        if(!found)
                             li.add(ans == Byte.MAX_VALUE ? -1: ans);
        //                   li.add(ans == INF ? -1: ans);

                    }

                    System.out.printf(&quot;Case #%d: %s\n&quot;,t,li.toString().replace(&quot;[&quot;, &quot;&quot;).replace(&quot;]&quot;, &quot;&quot;).replace(&quot;,&quot;, &quot;&quot;));
                }
            }
        }
&lt;/textarea&gt;
  
&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ff49/000000000043aee7&quot;&gt;Round H 2020 - Kick Start 2020 Editor. Here you can check whether your code satisfies Time and Space Complexity for the above problem.&lt;/a&gt;  

&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html&quot;&gt;Here is the link for Google KickStart Round F 2021 Trash Bins Problem.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/8244261975042148378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/10/round-h-2020-google-kick-start-friends.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/8244261975042148378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/8244261975042148378'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/10/round-h-2020-google-kick-start-friends.html' title='Round H 2020 Google Kick Start Friends Problem - Java'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s72-c/Screenshot+%2528363%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-6036051414194723139</id><published>2021-10-09T01:54:00.008+05:30</published><updated>2021-10-12T02:39:16.484+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Find duplicate elements in an array including negative numbers"/><category scheme="http://www.blogger.com/atom/ns#" term="java hashtable find duplicate element"/><category scheme="http://www.blogger.com/atom/ns#" term="Round H 2020 Kick Start Rugby Problem"/><title type='text'>How to find the duplicate elements in an array (negative numbers) and Round H 2020 Google Kick Start Rugby Problem solved in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;/&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;
  
&lt;body id=&quot;para&quot;&gt;
&lt;span id=&quot;para&quot;&gt;
  
&lt;a id=&quot;head&quot;&gt;Duplicate Elements in an Array&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
  
&lt;textarea  wrap=&quot;off&quot; style=&quot;height:30vh;&quot;&gt;

    For Example: 

        Input : -1 -2 -3 1 -3 -6 6

        Duplicate : -3

        Original : -1 -2 -3 1 -6 6
&lt;/textarea&gt;  
  
&lt;br/&gt;
Here we have implemented List Interface and Hashtable Collection Framework from util package. It is not necessary to use List Interface instead we can choose any other Interfaces according to how we want our data to be stored or we can direcly print the duplicate numbers directly. 
&lt;br/&gt;&lt;br/&gt;  
Now, Let me explain how Hashtables works we have to implement Hashtable with atleast two arguments one is for Index as Integer and another one is for our values to be stored in that Index.
&lt;br/&gt;&lt;br/&gt;  
Here we have iterated through all the values one by one to check whether the values are present in Hashtable or not. If the value is not in the table we have to insert those values in the Hashtable and if the value is present in the table either we can print the values or omit or to store the data for future use. Now we can print Original values using print statement. Instead of using Numbers we also can use String, Characters as our values.
&lt;br/&gt;&lt;br/&gt;  
  
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;   
  
&lt;br/&gt;  
&lt;a id=&quot;head&quot;&gt;Java Code&lt;/a&gt;&lt;br/&gt;&lt;br&gt;  

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:100vh;&quot;&gt;
  
      import java.util.*;

      public class Solution  {
          public static List&lt;Integer&gt; findDuplicates(int[] nums) {

              Hashtable&lt;Integer,Integer&gt; h = new Hashtable&lt;Integer,Integer&gt;();
              List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;();
              for(int i=0; i&lt;nums.length; i++) {
                  if(h.containsValue(nums[i])) {
                      list.add(nums[i]);
                  }
                  else {
                      h.put(i,nums[i]);
                  }
              }
              return list;
          }

          public static void main(String[] args){
              Scanner sc = new Scanner(System.in);

              int a[] = {-1, -2, -3, 1, -3, -6, 6};
              System.out.println(findDuplicates(a));

          }
      }
&lt;/textarea&gt;  
  
&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Round H 2020 Kick Start Rugby problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s604/Screenshot+%2528363%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;513&quot; data-original-width=&quot;604&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s400/Screenshot+%2528363%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;

&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
On a far away planet, rugby is played in the two dimensional Cartesian coordinate system without bounds. The players can occupy integer grid points only and they can move to the neighboring grid points in any of the four cardinal directions. Specifically, if a player is currently at the point (X, Y), then they can move to either of the points (X+1, Y), (X-1, Y), (X, Y+1), or (X, Y-1) in a single step.
&lt;br/&gt;&lt;br/&gt;
After the game, N players are scattered throughout the coordinate system such that any grid point is empty or occupied by one or more players. They want to gather for a picture and form a perfect horizontal line of N grid points, one player per point, all occupied points next to each other. Formally, the players have to move so as to occupy the grid points (X, Y), (X+1, Y), (X+2, Y), ..., (X+N-1, Y) for some coordinates X and Y. What is the minimum total number of steps the players should make to form a perfect line if they are free to choose the position of the line in the coordinate system and the ordering of players is not important?
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases T. T test cases follow. The first line of each test case gives the number of players N. The subsequent N lines give the initial coordinates of the players. The i-th of these lines contains two integers Xi and Yi, which describe the initial position of i-th player (1 ≤ i ≤ N).
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the minimum total number of steps that the players need to make in order to form a perfect horizontal line.  
&lt;br/&gt;&lt;br/&gt;  
  

&lt;a id=&quot;head&quot;&gt;Limits&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Memory limit: 1 GB.
1 ≤ T ≤ 100.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 20 seconds.
1 ≤ N ≤ 10.
-500 ≤ Xi ≤ 500.
-500 ≤ Yi ≤ 500.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 40 seconds.
1 ≤ N ≤ 105 for at most 10 cases.
1 ≤ N ≤ 104 for the remaining cases.
-109 ≤ Xi ≤ 109.
-109 ≤ Yi ≤ 109.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Sample&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj9Z4-D0ps-vuHOIqAutIelZuY_MBzsUYj0gpMtLEkaWGQuFrIHQgDNprb-rDTMJcH6Ndvs9xt0uwewvkw4lwVolUGkmvg1c7uxUdQ8uRNSTZVK-XVDjTkFQ07ymwte3iuJMitJ_8PiwvO86qiiLdPTCV1ca9YI7Ov-pdpoV9qkSgg3cPN9nQd9EtjJ_g=s353&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;400&quot; data-original-height=&quot;353&quot; data-original-width=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj9Z4-D0ps-vuHOIqAutIelZuY_MBzsUYj0gpMtLEkaWGQuFrIHQgDNprb-rDTMJcH6Ndvs9xt0uwewvkw4lwVolUGkmvg1c7uxUdQ8uRNSTZVK-XVDjTkFQ07ymwte3iuJMitJ_8PiwvO86qiiLdPTCV1ca9YI7Ov-pdpoV9qkSgg3cPN9nQd9EtjJ_g=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
In the first test case, one of many optimal solutions is obtained by the second player moving two steps to the left and three steps down to the point (2, 1).
&lt;br&gt;&lt;br/&gt;
In the second test case, a perfect line can be formed with a total of four steps if the first player moves to the point (0, 2) and the third player moves to the point (2, 2).
&lt;br&gt;&lt;br&gt;
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt; 
  

&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:140vh;&quot;&gt;

      import java.util.*;

      public class Solution {
          public static void main(String[] args) {
              Scanner sc = new Scanner(System.in);

              int test = sc.nextInt();

              for(int t=0; t&lt;test; t++) {

                  long n = sc.nextInt();
                  long a[] = new long[(int) n];
                  long b[] = new long[(int) n];

                  for(int i=0; i&lt;n; i++) {
                      a[i] = sc.nextLong();
                      b[i] = sc.nextLong();
                  }

                  long add =0;
                  Arrays.sort(b);
                  add += solve(b);


                  Arrays.sort(a);

                  for(long i=0; i&lt;n; i++) {
                      a[(int) i] -= i;
                  }

                  Arrays.sort(a);
                  add += solve(a);

                  System.out.printf(&quot;Case #%d: %d\n&quot;,t+1,add);
              }
          }

          private static long solve(long[] a) {

              long mid = a[a.length/2];
              long result = 0; 
              for(int i=0; i&lt;a.length; i++) {
                  result += Math.abs(a[i] - mid);
              }
              return result;
          }

      }

&lt;/textarea&gt;
  
&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ff49/000000000043b027&quot;&gt;Round H 2020 - Kick Start 2020 Editor. Here you can check whether your code satisfies Time and Space Complexity of the Problem.&lt;/a&gt;  

&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html&quot;&gt;Here is the link for Google KickStart Round F 2021 Trash Bins Problem.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/6036051414194723139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/10/find-duplicate-elements-in-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6036051414194723139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6036051414194723139'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/10/find-duplicate-elements-in-array.html' title='How to find the duplicate elements in an array (negative numbers) and Round H 2020 Google Kick Start Rugby Problem solved in Java'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s72-c/Screenshot+%2528363%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-4280441986473070478</id><published>2021-10-02T01:33:00.001+05:30</published><updated>2021-10-12T21:59:32.540+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Boring Numbers Problem"/><category scheme="http://www.blogger.com/atom/ns#" term="Google Kick Start Round H 2020"/><category scheme="http://www.blogger.com/atom/ns#" term="Solved Competitive Problem in Java."/><title type='text'>Round H 2020 Google Kick Start Boring Numbers Problem | Java </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s604/Screenshot+%2528363%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;513&quot; data-original-width=&quot;604&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s400/Screenshot+%2528363%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
Ron read a book about boring numbers. According to the book, a positive number is called boring if all of the digits at even positions in the number are even and all of the digits at odd positions are odd. The digits are enumerated from left to right starting from 1. For example, the number 1478 is boring as the odd positions include the digits {1, 7} which are odd and even positions include the digits {4, 8} which are even.
&lt;br/&gt;&lt;br/&gt;
Given two numbers L and R, Ron wants to count how many numbers in the range [L, R] (L and R inclusive) are boring. Ron is unable to solve the problem, hence he needs your help.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow. Each test case consists of a single line with two numbers L and R.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;  
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the count of boring numbers. 
&lt;br/&gt;&lt;br/&gt;

&lt;a id=&quot;head&quot;&gt;Limits&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Time limit: 20 seconds.
Memory limit: 1 GB.
1 ≤ T ≤ 100.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
1 ≤ L ≤ R ≤ 103.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Test Set 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
1 ≤ L ≤ R ≤ 1018.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Sample&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgdPXhSh-v7F76DHGAtG7O9Sl_GXRtVaHIzOoRfb7ENMOZCvld_n_mL3Dm0qZfnGfjgE5FxZLoWQUBYy9jVwhv8eJMgYNyN2lHYc19YAPFFYtNxI-JkDPAZGy-UT5yZ7nO3hTIX9AyRI6D16TRiHVpnIOOctAfYILbvPShne8CqLmLXwM_O521DS-OuSA=s454&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;317&quot; data-original-width=&quot;454&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgdPXhSh-v7F76DHGAtG7O9Sl_GXRtVaHIzOoRfb7ENMOZCvld_n_mL3Dm0qZfnGfjgE5FxZLoWQUBYy9jVwhv8eJMgYNyN2lHYc19YAPFFYtNxI-JkDPAZGy-UT5yZ7nO3hTIX9AyRI6D16TRiHVpnIOOctAfYILbvPShne8CqLmLXwM_O521DS-OuSA=s400&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
In Sample Case #1, the numbers in the range are {5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15} out of which {5, 7, 9, 10, 12, 14} are boring, hence the answer is 6.
&lt;br&gt;&lt;br/&gt;
In Sample Case #2, the numbers in the range are {120, 121, 122, 123, 124, 125} out of which {121, 123, 125} are boring, hence the answer is 3.
&lt;br&gt;&lt;br&gt;  
In Sample Case #3, the numbers in the range are {779, 780, 781, 782, 783} out of which {781, 783} are boring, hence the answer is 2.
&lt;br&gt;&lt;br&gt;  
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt; 
  

&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:140vh;&quot;&gt;

      import java.util.*;
      public class Solution{

          public static long five[] = new long[20];
          public static long pre[] = new long[20];

          public static class Solu{
              int a[] = {0,0,1,1,2,2,3,3,4,4};
               int b[] = {0,1,1,2,2,3,3,4,4,5};

              public long count(long x) {
                  String s = Long.toString(x);
                  int n = s.length();
                  char s1[] = s.toCharArray();
                  long ans = pre[n-1];
                  for(int i=1; i&lt;=n; ++i) {
                      int c = s1[i-1] - &#39;0&#39;;
                      if(c% 2 != i% 2) {
                          ans += five[n-i] * b[c];
                          break;
                      }else {
                          ans += five[n-i] * a[c];
                          if(i==n)
                              ans++;
                      }
                  }
                  return ans;
              }

          public void solve(int case_num,long L,long R) {
              System.out.printf(&quot;Case #%d: %d\n&quot;,case_num, count(R)- count(L-1));
          }
         }  

          public static void main(String[] args) {
               Scanner sc = new Scanner(System.in);


               int t= sc.nextInt();
               five[0] = (long) 1;
               for(int i=1; i&lt;20; ++i) {
                   five[i] = five[i-1]*5;
               }
               pre[0] = (long) 0;
               for(int i=1; i&lt;20; ++i) {
                   pre[i] = pre[i-1]+five[i];
               }
               for(int i=1; i&lt;=t; ++i) {
                   Solu solution = new Solu(); 
                   long l = sc.nextLong();
                   long r = sc.nextLong();
                   solution.solve(i,l,r);
               }
          }
      }
&lt;/textarea&gt;
  
&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ff49/000000000043b0c6&quot;&gt;Round H 2020 - Kick Start 2020 Editor. Here you can check whether your code satisfies Time and Space Complexity of the Problem.&lt;/a&gt;  

&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html&quot;&gt;Here is the link for Google KickStart Round F 2021 Trash Bins Problem.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/4280441986473070478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/10/round-h-2020-google-kick-start-boring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4280441986473070478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4280441986473070478'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/10/round-h-2020-google-kick-start-boring.html' title='Round H 2020 Google Kick Start Boring Numbers Problem | Java '/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s72-c/Screenshot+%2528363%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-2567391901863348936</id><published>2021-09-25T02:19:00.005+05:30</published><updated>2021-09-30T19:40:54.099+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Merge Cards Problem 2020"/><category scheme="http://www.blogger.com/atom/ns#" term="Round G 2020 Google Kick Start"/><title type='text'>Round G 2020 Google Kick Start Merge Cards Problem - Java Solution</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s604/Screenshot+%2528363%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;513&quot; data-original-width=&quot;604&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s400/Screenshot+%2528363%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
Panko is playing a game with N cards laid out in a row. The i-th card has the integer Ai written on it.
&lt;br/&gt;&lt;br/&gt;
The game is played in N - 1 rounds. During each round Panko will pick an adjacent pair of cards and merge them. Suppose that the cards have the integers X and Y written on them. To merge two cards, Panko creates a new card with X + Y written on it. He then removes the two original cards from the row and places the new card in their old position. Finally Panko receives X + Y points for the merge. During each round Panko will pick a pair of adjacent cards uniformly at random amongst the set of all available adjacent pairs.
&lt;br/&gt;&lt;br/&gt;
After all N - 1 rounds, Panko&#39;s total score is the sum of points he received for each merge. What is the expected value of Panko&#39;s total score at the end of the game?
&lt;br&gt;&lt;br&gt;  
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow. Each test case begins with a line containing the integer N. A second line follows containing N integers, describing the initial row of cards. The i-th integer is Ai.
&lt;br/&gt;&lt;br/&gt;
  

&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the expected total score at the end of the game.
&lt;br/&gt;&lt;br/&gt;
y will be considered correct if it is within an absolute or relative error of 10-6 of the correct answer. See the FAQ for an explanation of what that means, and what formats of real numbers we accept.
&lt;br&gt;&lt;br&gt;  
  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdH9qyJ_a5fVdSSIsAzV-9TGicwg6qmpk62H1vzhXMz65_7EuXLph7QeQx9T886hy8Nn7y-5tPbUJDsRRamPMV3hFsEmEuGxDBppFItyIqZiQR9GRNPZbXGyM64PK9AWg-gR3ZEk4dXVFv/s440/Screenshot+%2528365%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;231&quot; data-original-width=&quot;440&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdH9qyJ_a5fVdSSIsAzV-9TGicwg6qmpk62H1vzhXMz65_7EuXLph7QeQx9T886hy8Nn7y-5tPbUJDsRRamPMV3hFsEmEuGxDBppFItyIqZiQR9GRNPZbXGyM64PK9AWg-gR3ZEk4dXVFv/s400/Screenshot+%2528365%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
In sample case #1, N = 3. The initial row of cards is [2, 1, 10]. In the first round, Panko has two choices, of which he will choose one at random.
&lt;br&gt;&lt;br/&gt;
If Panko merges the first pair (2, 1), then the row of cards becomes [3, 10], adding 2 + 1 = 3 points to his total score. In the second round, there is only one pair remaining (3, 10). If he merges them, the row of cards becomes [13], adding 3 + 10 = 13 points to his total score. Panko ends the game with 3 + 13 = 16 points.&lt;br&gt;
If Panko merges the second pair (1, 10), then the row of cards becomes [2, 11], adding 1 + 10 = 11 points to his total score. In the second round, there is only one pair remaining (2, 11). If he merges them, the row of cards becomes [13], adding 2 + 11 = 13 points to his total score. Panko ends the game with 11 + 13 = 24 points.
Thus, the expected number of points Panko ends the game with is (16 + 24)/2 = 20.
&lt;br&gt;&lt;br&gt;  
In sample case #2, N = 5. The initial row of cards is [19, 3, 78, 2, 31]. There are too many possibilities to list here, so we will only go through one possible game:
&lt;br&gt;&lt;br&gt;
In the first round, if Panko merges the pair (78, 2), then the row of cards becomes [19, 3, 80, 31], adding 78 + 2 = 80 to his score.&lt;br&gt;
In the second round, if Panko merges the pair (80, 31), then the row of cards becomes [19, 3, 111], adding 80 + 31 = 111 to his score.&lt;br&gt;
In the third round, if Panko merges the pair (19, 3), then the row of cards becomes [22, 111], adding 19 + 3 = 22 to his score.&lt;br&gt;
In the fourth round, if Panko merges the pair (22, 111), then the row of cards becomes [133], adding 22 + 111 = 133 to his score.&lt;br&gt;
At the end of the game explained above, Panko&#39;s total score is 80 + 111 + 22 + 133 = 346.
&lt;br&gt;&lt;br&gt;  
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt; 
  

&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:140vh;&quot;&gt;

      import java.util.*;
      public class Solution {

          public static void main(String[] args) {
  
                Scanner sc = new Scanner(System.in);
                int t = sc.nextInt();

                for(int test=0; test&lt;t; test++) {
                     double dp[][]= new double[5000][5000];
                      double sum[] = new double[5000];
                      double s[] = new double[5000];
                      double e[] = new double[5000];
                    int n = sc.nextInt();
                    double a[] = new double[n];
                    for(int i=0; i&lt;n; i++) {
                        a[i] = sc.nextDouble();
                        s[i]=0;
                        e[i]=0;
                    }
                    sum[0] = a[0];

                    for(int i=1; i&lt;n; i++) {
                        sum[i] = sum[i-1]+a[i];
                    }

                    for(int i=0; i&lt;n; i++) {
                        dp[0][i] =0;
                    }

                    for(int i=1; i&lt;n; i++) {
                        for(int j=0; i+j&lt;n; j++) {
                            dp[i][j] = i*sum[i+j];
                            if(j&gt;0) {
                                dp[i][j]-=i*sum[j-1];
                            }
                            dp[i][j]+=s[j];
                            dp[i][j]+=e[i+j];
                            dp[i][j]/=i;
                        }
                        for(int j=0; i+j&lt;n; j++) {
                            s[j]+=dp[i][j];
                            e[i+j]+=dp[i][j];
                        }
                    }

                    System.out.printf(&quot;Case #%d: %.6f\n&quot;,test+1,dp[n-1][0]);
                }
          }
      }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html&quot;&gt;Here is the link for Google KickStart Round F 2021 Trash Bins Problem.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/2567391901863348936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/09/round-g-2020-google-kick-start-merge.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/2567391901863348936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/2567391901863348936'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/09/round-g-2020-google-kick-start-merge.html' title='Round G 2020 Google Kick Start Merge Cards Problem - Java Solution'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s72-c/Screenshot+%2528363%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-8022220321579602194</id><published>2021-09-23T00:32:00.007+05:30</published><updated>2021-09-29T23:35:42.037+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Combination Lock"/><category scheme="http://www.blogger.com/atom/ns#" term="Kick_Start Problem. Kick Start 2020 Round G Problems Solved."/><category scheme="http://www.blogger.com/atom/ns#" term="Maximum Coins"/><title type='text'>Round G 2020 Google Kick Start Combination Lock, Maximum Coins and Kick_Start Problem | Java </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s604/Screenshot+%2528363%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;513&quot; data-original-width=&quot;604&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s400/Screenshot+%2528363%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Kick_Start&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
Ksenia is very fond of reading so she kicks off each day by reading a fragment from her favourite book before starting with the rest of her morning routine. A fragment is simply a substring of the text. Ksenia is somewhat superstitious and believes that her day will be lucky if the fragment she reads starts with the string KICK, then goes on with 0 or more characters, and eventually ends with the string START, even if the overall fragment makes little sense.
&lt;br/&gt;&lt;br/&gt;
Given the text of the book, count the number of different lucky fragments that Ksenia can read before the book gets old and she needs to buy another one. Two fragments are considered to be different if they start or end at different positions in the text, even if the fragments read the same. Also note that different lucky fragments may overlap.
&lt;br/&gt;&lt;br/&gt;

  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases T. T lines follow, each containing a single string S consisting of upper case English letters only.
&lt;br/&gt;&lt;br/&gt;
  

&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the number of different lucky fragments in the text of this test case.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ3jgEcXVBw6FZzXW9k-AVDmG6K10IxLHw4VtgdFNRmoiCY6fWM-DQLwQpR3GKpuAn-9bmwSBfqh_a2FvHT-GI1QX0r2JwY0BFXaMOEeT7ev5rtcU5rvUPZXK_mNyvbiW2V8QGDC8_M_vl/s631/Screenshot+%2528360%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;261&quot; data-original-width=&quot;631&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ3jgEcXVBw6FZzXW9k-AVDmG6K10IxLHw4VtgdFNRmoiCY6fWM-DQLwQpR3GKpuAn-9bmwSBfqh_a2FvHT-GI1QX0r2JwY0BFXaMOEeT7ev5rtcU5rvUPZXK_mNyvbiW2V8QGDC8_M_vl/s400/Screenshot+%2528360%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
There are three lucky fragments in the first test case, namely, KICKSTARTPROBLEMNAMEDKICKSTART and two occurrences of KICKSTART. The text in the second test case has no lucky fragments at all.
&lt;br&gt;&lt;br/&gt;


&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:110vh;&quot;&gt;

          import java.util.*;
          public class Solution {

              public static void main(String[] args) {
                  Scanner sc = new Scanner(System.in);

                  int t =sc.nextInt();
                  for(int i=0; i&lt;t; i++) {

                      String s = sc.next();

                      int count =0;
                      int favourite =0;
                      for(int j=0; j&lt;s.length(); j++) {
                          try {
                          if(s.charAt(j)==&#39;K&#39; &amp;&amp; s.charAt(j+1)==&#39;I&#39; &amp;&amp; s.charAt(j+2)==&#39;C&#39; &amp;&amp; s.charAt(j+3) == &#39;K&#39;) {
                              count ++;
                          }
                          else if(s.charAt(j)==&#39;S&#39; &amp;&amp; s.charAt(j+1)==&#39;T&#39; &amp;&amp; s.charAt(j+2)==&#39;A&#39; &amp;&amp; s.charAt(j+3) == &#39;R&#39; &amp;&amp; s.charAt(j+2)==&#39;A&#39; &amp;&amp;                                  s.charAt(j+4) == &#39;T&#39;) {

                              favourite += count;
                          }
                          }
                          catch(Exception e) {
                              break;
                          }
                      }

                      System.out.printf(&quot;Case #%d: %d\n&quot;,i+1,favourite);
                  }
              }

          }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;
  
  
&lt;a id=&quot;head&quot;&gt;Maximum Coins&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
Mike has a square matrix with N rows and N columns. Cell (i,j) denotes the cell present at row i and column j. Cell (1,1) denotes the top left corner of the matrix. Each cell has some amount of coins associated with it and Mike can collect them only if he visits that cell. Ci,j represents the number of coins in cell with row i and column j. From a cell (i,j), Mike can decide to go to cell (i+1,j+1) or cell (i-1,j-1), as long as the cell lies within the boundaries of the matrix and has not been visited yet. He can choose to start the journey from any cell and choose to stop at any point. Mike wants to maximize the number of coins he can collect. Please help him determine the maximum number of coins he can collect.
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow. Each test case begins with a line containing the integer N. The next N lines contain N integers each. The j-th integer in the i-th line represents the number of coins Ci,j in cell (i,j).
&lt;br/&gt;&lt;br/&gt;
  

&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the maximum number of coins Mike can collect.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFV0LiWeC4YaUXifS2Xi31rLnswRXKj76mAiWlublnz6ywFFfdTSqOhTP8hSUuXMx5VozZSyuZ2dmYakTX-RocANnFowersEW6XI2LhRKsqODL61fWof0fchM_1L9Kd0UIL6IeAtj6OV0_/s501/Screenshot+%2528361%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;400&quot; data-original-height=&quot;501&quot; data-original-width=&quot;338&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFV0LiWeC4YaUXifS2Xi31rLnswRXKj76mAiWlublnz6ywFFfdTSqOhTP8hSUuXMx5VozZSyuZ2dmYakTX-RocANnFowersEW6XI2LhRKsqODL61fWof0fchM_1L9Kd0UIL6IeAtj6OV0_/s400/Screenshot+%2528361%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
In Sample Case #1, the maximum number of coins collected can be 14, if Mike follows this path: (1,1) -&gt; (2,2) -&gt; (3,3)
&lt;br&gt;&lt;br/&gt;
In Sample Case #2, the maximum number of coins collected can be 9, if Mike follows this path: (2,3) -&gt; (3,4).
&lt;br/&gt;&lt;br/&gt;
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:160vh;&quot;&gt;

      import java.util.*;
      public class Solution {

          public static void main(String[] args) {
              Scanner sc = new Scanner(System.in);

              int t = sc.nextInt();
              for(int i=0; i&lt;t; i++) {
                  int n = sc.nextInt();

                  int a[][] = new int[n][n];

                  for(int j=0; j&lt;n; j++) {
                      for(int k=0; k&lt;n; k++) {
                          a[j][k] = sc.nextInt();
                      }
                  }


                  System.out.printf(&quot;Case #%d: %d\n&quot;,i+1,max(a,n));
              }

          }

          private static long max(int[][] a, int n) {

              long temp_left=0;

              for(int i=0; i&lt;n; i++) {
                  int temp = i;
                  long temp_add=0;
                  for(int j=0; j&lt;n-i; j++) {
                      temp_add +=	a[temp][j];
                      temp++;
                  }
                  if(temp_left &lt; temp_add) temp_left = temp_add;
              }

              long temp_right=0;

              for(int i=0; i&lt;n; i++) {
                  int temp = i;
                  long temp_add=0;
                  for(int j=0; j&lt;n-i; j++) {
                      temp_add +=	a[j][temp];
                      temp++;
                  }
                  if(temp_right &lt; temp_add) temp_right = temp_add;
              }


              return Math.max(temp_left, temp_right);
          }

      }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;
  
  
  
&lt;a id=&quot;head&quot;&gt;Combination Lock&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
A combination lock has W wheels, each of which has the integer values 1 through N on it, in ascending order.
&lt;br/&gt;&lt;br/&gt;
At any moment, each wheel shows a specific value on it. Xi is the initial value shown on the i-th wheel.
&lt;br/&gt;&lt;br/&gt;
To save time, every house owner always takes their trash out to the trash bin that is closest to their houses. If there are two trash bins that are both the closest to a house, then the house owner can walk to any of them.  
&lt;br/&gt;&lt;br/&gt;
You can use a single move to change a wheel from showing the value X to showing either X+1 or X-1, wrapping around between 1 and N. For example, if a wheel currently shows the value 1, in one move you can change its value to 2 or N.
&lt;br&gt;&lt;br&gt;  
Given all wheels&#39; initial values, what is the minimum number of moves to get all wheels to show the same value?
&lt;br&gt;&lt;br&gt;  
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow.
&lt;br/&gt;&lt;br/&gt;
The first line of each test case contains the two integers W and N.  
&lt;br&gt;&lt;br&gt;
The second line contains W integers. The i-th integer is Xi. 
&lt;br&gt;&lt;br&gt;  
  

&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the minimum number of moves to get all wheels to show the same value.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOhHubDScQdz-udBpkwd2d-_5-55x3tkxP9uBwiY90ImMV4oDhXkny1X8Mzn3QBV4eyOCH2pGQn6o8UIBNO1Rwk0Xw1RmTgB7Q96lltiDSXQ50z0_E0Wp1_Cc3xPIYeO2NYhKpig3rDrcN/s467/Screenshot+%2528362%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;269&quot; data-original-width=&quot;467&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOhHubDScQdz-udBpkwd2d-_5-55x3tkxP9uBwiY90ImMV4oDhXkny1X8Mzn3QBV4eyOCH2pGQn6o8UIBNO1Rwk0Xw1RmTgB7Q96lltiDSXQ50z0_E0Wp1_Cc3xPIYeO2NYhKpig3rDrcN/s400/Screenshot+%2528362%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
In Sample Case #1, the best solution is to get all wheels to show value 3, which would take a total of 2 moves: the first wheel would move once (from value 2 to value 3), the second wheel would not move (it already shows value 3), and the third wheel would move once (from value 4 to value 3).
&lt;br&gt;&lt;br/&gt;
For reference, it would take 5 moves to get all wheels to show value 1, 3 moves to get all wheels to show value 2, 3 moves to get all wheels to show value 4, and 5 moves to get all wheels to show value 5.
&lt;br/&gt;&lt;br/&gt;
In Sample Case #2, the best solutions are to get all wheels to show either value 1, 2, 9 or 10, which would take a total of 8 moves.  
&lt;br&gt;&lt;br&gt;  
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;span id=&quot;head&quot;&gt;Java Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:140vh;&quot;&gt;

      import java.util.*;
      public class Solution {
          public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);

            int t = sc.nextInt();
            for(int i=0; i&lt;t; i++) {
                long w = sc.nextLong();
                long n = sc.nextLong();
                long a[] = new long[(int) (w)];

                for(int j=0; j&lt;w; j++ ) {
                    a[j] = sc.nextLong();
                }

                Arrays.sort(a);

                long c[] = new long[(int) (3*w)];
                System.arraycopy(a, 0, c, 0, a.length);
                for(long j=0; j&lt;w; j++) {
                    c[(int) (j+w)] = c[(int) j];
                    c[(int) (j+w+w)] = c[(int) j]+n;
                    c[(int) j]-=n;
                }


                long minscroll = Long.MAX_VALUE;
                long b[] = new long[(int) (3*w)];

                b[0] = c[0];
                for(long j=1; j&lt;3*w; j++) {
                    b[(int) j] = b[(int) (j-1)]+c[(int) j];
                }


                for(long j=w; j&lt;2*w; j++) {
                    long k = j-(w+1)/2;
                    long temp = (b[(int) (k+w)]-b[(int) (j-1)])- c[(int) j]*(k+w-(j-1));
                    temp += c[(int) j]*(j-1-k)-(b[(int) (j-1)]-b[(int) k]);
                    minscroll = Math.min(minscroll, temp);
                }
                System.out.printf(&quot;Case #%d: %d\n&quot;,i+1,minscroll);
            }
         }	
      }	
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;  
  &lt;a href=&quot;https://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html&quot;&gt;Here is the link for Google KickStart Round F 2021 Trash Bins Problem.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/8022220321579602194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/09/round-g-2020-google-kick-start.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/8022220321579602194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/8022220321579602194'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/09/round-g-2020-google-kick-start.html' title='Round G 2020 Google Kick Start Combination Lock, Maximum Coins and Kick_Start Problem | Java '/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4FHw9ZFcjin8H5Pbju4PCP6QPgg_-4L_mq_LnjwZaNaa-EIUoaM9Yo1GcRaxGP-KV-EQp59jlkyB6tPURUZazmSfs3vArhyphenhyphen4WEUMzV6X4S2BQ6yuApJ8N98AjbLovSrGsw6IwzOLRx9-D/s72-c/Screenshot+%2528363%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-1474444636687311482</id><published>2021-09-20T21:54:00.008+05:30</published><updated>2021-09-29T23:35:09.863+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Trash Bins problem round F 2021 Kick Start"/><title type='text'>Round F 2021 Google Kick Start Trash Bins Problem | Java | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 160vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1IM8AleZUukrTDF_q1YAaj3P3GTKGFYGg2Go477HvFOUPifWKUd2x2vwWG4Yr2FYI1N8dMDo6-QfMZ8GysLtX69D7ZKloyyFIOXgf9biVMIis8c_eWJtrFzZ-eP5E0TCThgwIgajkFIDs/s267/Screenshot+%2528356%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;190&quot; data-original-width=&quot;267&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1IM8AleZUukrTDF_q1YAaj3P3GTKGFYGg2Go477HvFOUPifWKUd2x2vwWG4Yr2FYI1N8dMDo6-QfMZ8GysLtX69D7ZKloyyFIOXgf9biVMIis8c_eWJtrFzZ-eP5E0TCThgwIgajkFIDs/s400/Screenshot+%2528356%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
In the city where you live, Kickstartland, there is one particularly long street with N houses on it. This street has length N, and the N houses are evenly placed along it, that is, the first house is at position 1, the second house is at position 2, and so on. The distance between any pair of houses i and j is |i−j|, where |x| denotes the absolute value of x.
&lt;br/&gt;&lt;br/&gt;
Some of these houses have trash bins in front of them. That means that the owners of such houses do not have to walk when they want to take their trash out. However, for the owners of houses that do not have trash bins in front of them, they have to walk towards some house that has a trash bin in front of it, either to the left or to the right of their own house.
&lt;br/&gt;&lt;br/&gt;
To save time, every house owner always takes their trash out to the trash bin that is closest to their houses. If there are two trash bins that are both the closest to a house, then the house owner can walk to any of them.  
&lt;br/&gt;&lt;br/&gt;
Given the number of houses N, and the description of which of these houses have trash bins in front of them, find out what is the sum of the distances that each house owner has to walk to take their trashes out. You can assume that at least one house has a trash bin in front of it.
&lt;br&gt;&lt;br&gt;  
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow. Each test case consists of two lines.
&lt;br/&gt;&lt;br/&gt;
The first line of each test case contains an integer N, denoting the number of houses on the street.  
&lt;br&gt;&lt;br&gt;
The second line of each test case contains a string S of length N, representing which houses have trash bins in front of them. If the i-th character in string S is equal to 1, then it means that the i-th house has a trash bin in front of it. Otherwise, if it is equal to 0, then it means that the i-th house does not have a trash bin in front of it.  
&lt;br&gt;&lt;br&gt;  
  

&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the sum of the distances that each house owner has to walk to take their trashes out.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu0adtnFDmb4349J8tCBsnTbifS0mKwNOr1ehQFleAcLLRPWntvHWqvlr6BluecPqLcn4os8mGfE6-nSj2fGgE0Qw_0tC7oxFtwJMFVMci23iOyqXJobbm4fQVJb2ereHgBg1fMiZSlm9k/s530/Screenshot+%2528355%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;600&quot; data-original-height=&quot;165&quot; data-original-width=&quot;530&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu0adtnFDmb4349J8tCBsnTbifS0mKwNOr1ehQFleAcLLRPWntvHWqvlr6BluecPqLcn4os8mGfE6-nSj2fGgE0Qw_0tC7oxFtwJMFVMci23iOyqXJobbm4fQVJb2ereHgBg1fMiZSlm9k/s600/Screenshot+%2528355%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
For the first test case, every house has a trash bin in front of it, and therefore none of the house owners will have to walk to take their trashes out.
&lt;br&gt;&lt;br/&gt;
For the second test case, the first and the fourth house owners have trash bins in front of their houses, and therefore will not have to walk. The second house owner will walk towards the first house, and the distance will be equal to 1. The third, fifth, and sixth house owners will walk towards the fourth house, and the distances will be equal to 1, 1, and 2, respectively.
&lt;br/&gt;&lt;br/&gt;
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot;&gt;

      import java.util.*;

      public class Solution{
          public static void main(String[] args) {
              Scanner sc = new Scanner(System.in);

              int t = sc.nextInt();
              for(int i=0; i&lt;t; i++) {
                  int n = sc.nextInt();
                  String s = sc.next();
                  long total = trash(n,s);
                  System.out.printf(&quot;Case #%d: %d\n&quot;,i+1,total);
              }
          }

          private static long trash(int n, String s) {
              Scanner sc = new Scanner(System.in);

              int left[] = new int[n];
              int right[] = new int[n];
              int x = Integer.MIN_VALUE;

              for(int i=0; i&lt;n; i++) {
                  if(s.charAt(i) == &#39;1&#39;) x = i;

                  left[i] = x;
              }

              int y = Integer.MAX_VALUE;

              for(int i=n-1; i&gt;=0; i--) {
                  if(s.charAt(i) == &#39;1&#39;) y = i;

                  right[i] = y;	
              }

              long total =0;
              for(int i=0; i&lt;n; i++) {
                  if(left[i] &lt; 0) total += right[i]-i;
                  else
                  total += Math.min(right[i]-i, i-left[i]);
              }

              return total;
          }
      }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;
  &lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using JAVA.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/1474444636687311482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/1474444636687311482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/1474444636687311482'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/09/round-f-2021-google-kick-start-trash.html' title='Round F 2021 Google Kick Start Trash Bins Problem | Java | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1IM8AleZUukrTDF_q1YAaj3P3GTKGFYGg2Go477HvFOUPifWKUd2x2vwWG4Yr2FYI1N8dMDo6-QfMZ8GysLtX69D7ZKloyyFIOXgf9biVMIis8c_eWJtrFzZ-eP5E0TCThgwIgajkFIDs/s72-c/Screenshot+%2528356%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-7721338124528669706</id><published>2021-09-13T02:03:00.006+05:30</published><updated>2022-02-21T20:57:21.428+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="bit-plane slicing."/><category scheme="http://www.blogger.com/atom/ns#" term="black and white"/><category scheme="http://www.blogger.com/atom/ns#" term="dip example"/><category scheme="http://www.blogger.com/atom/ns#" term="gray"/><category scheme="http://www.blogger.com/atom/ns#" term="Image processing"/><category scheme="http://www.blogger.com/atom/ns#" term="Java digital image processing"/><category scheme="http://www.blogger.com/atom/ns#" term="negative"/><category scheme="http://www.blogger.com/atom/ns#" term="read"/><category scheme="http://www.blogger.com/atom/ns#" term="write"/><title type='text'>Image Processing in Java - Read, Write, to Black and White, to Gray, to Negative and Bit-Plane Slicing.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 180vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO2IgoUHJxpq4_SMXbBYBQ7GxsawzvsvJN4giuNtORPVe6f6cAxAo8hvlbY1O70qPy9Dm1INjYpJ3ZN0NXNQSRHcV7efQmKaaz1lJ7epYGMGoRMSB2ZzUVNLz7Aglw0EsbBx4fKD2pOi0d/s275/autumn_neg.jpg&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;183&quot; data-original-width=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO2IgoUHJxpq4_SMXbBYBQ7GxsawzvsvJN4giuNtORPVe6f6cAxAo8hvlbY1O70qPy9Dm1INjYpJ3ZN0NXNQSRHcV7efQmKaaz1lJ7epYGMGoRMSB2ZzUVNLz7Aglw0EsbBx4fKD2pOi0d/s400/autumn_neg.jpg&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;br&gt;  
&lt;a id=&quot;head&quot;&gt;Image Processing in Java&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
To store an image numbers are used in computers in an 2-Dimensional Array format the more the numbers in a pixel the more the clarity. Digital Image Processing is an important aspect which plays a major role in Artificial Intelligence, Machine learning, adjusting to Human Vision System, etc. Today our goal is to read an Image, write an Image, convert an Image to Black and White, convert an Image to Negative, and Bit-Plane Slicing using Java Programming Language.
  
&lt;br/&gt;&lt;br/&gt;&lt;a id=&quot;head&quot;&gt;Read and Write Image&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Here you are going to read and write an Image by giving the pathname of an Image file to read and a new pathname to write an Image.
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhizUfFLlcEOKPXP2UrWkNQcKTHZVdOnqtZbRzadsY1uJywfmcVXpiz8V00whkVz5Kt-UNOR0X67FoOr6msyY2sD53omkBXWLzN5SuBEotxk2V8djX87DHi1_zz_RyguCBpO-wS8EAASKx4/s275/autumn1.jpg&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;183&quot; data-original-width=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhizUfFLlcEOKPXP2UrWkNQcKTHZVdOnqtZbRzadsY1uJywfmcVXpiz8V00whkVz5Kt-UNOR0X67FoOr6msyY2sD53omkBXWLzN5SuBEotxk2V8djX87DHi1_zz_RyguCBpO-wS8EAASKx4/s400/autumn1.jpg&quot;/&gt;&lt;/a&gt;&lt;/div&gt;  
&lt;br/&gt;
&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:75vh;&quot;&gt;
  
      import java.io.*;
      import java.awt.image.*;
      import javax.imageio.*;
  
      public class randw{

          public static void main(String[] args) throws IOException{
  
          //    int width=1;
          //    int height=1;
              BufferedImage bi = null;
              File f=null;
              f=new File(&quot;D:\\VS Code\\JAVA\\autumn.jfif&quot;);
          //    bi = new BufferedImage(width,height,BufferedImage.TYPE_3BYTE_BGR);
              bi = ImageIO.read(f);
              System.out.println(&quot;Read Complete&quot;);
              f=new File(&quot;D:\\VS Code\\JAVA\\autumn2.png&quot;);
              ImageIO.write(bi,&quot;png&quot;,f);
              System.out.println(&quot;write Complete&quot;);
  
          }
      }

&lt;/textarea&gt;    
&lt;br&gt;
&lt;textarea  wrap=&quot;off&quot; style=&quot;height:16vh;&quot;&gt;
      
     f=new File(&quot;D:\\VS Code\\JAVA\\autumn2.png&quot;);
     ImageIO.write(bi,&quot;png&quot;,f);

&lt;/textarea&gt;  
&lt;br&gt;
Here&#39;s the Interesting part of the code, the above two lines determine the Image format while writing an Scanned Image. In the above code, type of the Image file was set to png with the help of this you can convert an Image file to another format. While converting a Image to another type file size also changes for Ex: converting a file to JPG will increase 4KB and converting the same file to PNG will increase file size to more than 100KB.
&lt;br&gt;&lt;br&gt;
In the above code io package&#39;s File Constructor is used to read the Image file using it&#39;s pathname and then readed by the BufferedImage using ImageIO.read(File), as I mentioned above again the destination pathname is stored in new File with a new File name and using ImageIO.write(Image readed using BufferedImage,&quot;format&quot;,pathname) Image is written in that path. 
&lt;br&gt;&lt;br&gt;  
To read and write an Image you have to use one of the AWT package sub classes called BufferedImage. In BufferedImage TYPE_3BYTE_BGR represents all the three colours red, green and blue are going to be in a 3 Byte format and it has no alpha value included, here you doesn&#39;t need any of the types from BufferedImage to read and write an Image.
&lt;br&gt;&lt;br&gt;  

  
&lt;a id=&quot;head&quot;&gt;Black and White Image&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Here you are going to read Image and convert it to Black and White and then write it in a destination folder.
&lt;br/&gt;&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-yzhkOEgqDbYF8RLHwfccz09qvmvOOkXFvxnV923xtA60mYQxd_FVoKVy0SCRpIk2ycZhMFEaQv8qiN1wDsyvdAMDU6VQoFWq888gBuOGlHFbn__VxSeCufHdGjcJnIsHSlcCPRUsQQKl/s275/bw1.jpg&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;183&quot; data-original-width=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-yzhkOEgqDbYF8RLHwfccz09qvmvOOkXFvxnV923xtA60mYQxd_FVoKVy0SCRpIk2ycZhMFEaQv8qiN1wDsyvdAMDU6VQoFWq888gBuOGlHFbn__VxSeCufHdGjcJnIsHSlcCPRUsQQKl/s400/bw1.jpg&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  

&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:102vh&quot;&gt;
     
      import java.io.File;
      import java.io.IOException;
      import java.awt.image.BufferedImage;
      import javax.imageio.ImageIO;
      import java.awt.*;
  
      public class randbw {
  
          public static void main(String[] args) {
  
              try{
                  File input=new File(&quot;D:\\VS Code\\JAVA\\autumn.jfif&quot;);
                  BufferedImage image=ImageIO.read(input);
                  BufferedImage result=new BufferedImage(
                      image.getWidth(),
                      image.getHeight(),
                      BufferedImage.TYPE_BYTE_BINARY   // TYPE_BYTE_GRAY

                  );
                  Graphics2D graphic =result.createGraphics();
                  graphic.drawImage(image,0,0,Color.WHITE,null);
                  graphic.dispose();
                  File output =new File(&quot;D:\\VS Code\\JAVA\\bw1.jpg&quot;);
                  ImageIO.write(result,&quot;jpg&quot;,output);

              }
              catch(IOException e) { 
                  e.printStackTrace();
              }
          }
      }

&lt;/textarea&gt;
&lt;br&gt;&lt;br&gt;
Graphics2D is also a sub class of AWT package it helps to draw an Image. Here the BufferedImage type is set to TYPE_BYTE_BINARY which creates Black Image by default and with the help of Graphics class image is rendered to Black and White. And for converting Image to Grey you have to set BufferedImage&#39;s type to TYPE_BYTE_GRAY in the above code. And the Try block is to check whether the code runs properly if not an error will be raised through the Catch block.
&lt;br /&gt;&lt;br/&gt;
  

  
&lt;a id=&quot;head&quot;&gt;Negative Image&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Read an Image and get each pixel&#39;s RGB value and subtract it with 255 to get a negative image atlas all we have to do is write that Image.
&lt;br/&gt;&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO2IgoUHJxpq4_SMXbBYBQ7GxsawzvsvJN4giuNtORPVe6f6cAxAo8hvlbY1O70qPy9Dm1INjYpJ3ZN0NXNQSRHcV7efQmKaaz1lJ7epYGMGoRMSB2ZzUVNLz7Aglw0EsbBx4fKD2pOi0d/s275/autumn_neg.jpg&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;183&quot; data-original-width=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO2IgoUHJxpq4_SMXbBYBQ7GxsawzvsvJN4giuNtORPVe6f6cAxAo8hvlbY1O70qPy9Dm1INjYpJ3ZN0NXNQSRHcV7efQmKaaz1lJ7epYGMGoRMSB2ZzUVNLz7Aglw0EsbBx4fKD2pOi0d/s400/autumn_neg.jpg&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  

&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:151vh;&quot;&gt;
     
      import java.awt.image.BufferedImage;
      import java.io.*;
      import javax.imageio.ImageIO;

      public class negative {

          public static void main(String args[]) throws IOException{
  
              BufferedImage img = null; File f = null;
              try {
                  f= new File(&quot;D:\\VS Code\\JAVA\\autumn.jfif&quot;);
                  img = ImageIO.read(f);
                  System.out.println(&quot;Input Image Completed&quot;);
              }catch(IOException e) {
                  System.out.println(e);
              }
  
              int width = img.getWidth();
              int height = img.getHeight();
  
              //convert to negative
              for(int i=0; i&lt;height; i++) {
                  for(int j=0; j&lt;width; j++) {
                      int p = img.getRGB(j,i);
                      int alpha = 255;
                      int red = (p&gt;&gt;16) ;
                      int green = (p&gt;&gt;8) 
                      int blue = p ;
  
                      red = 255 - red;
                      green = 255 - green;
                      blue = 255 - blue;
  
                      p=(alpha&lt;&lt;24) | (red&lt;&lt;16) | (green&lt;&lt;8) | blue;
                      img.setRGB(j, i, p);
                  }
              }

              try {
                  File file = new File(&quot;D:\\VS Code\\JAVA\\autumn_neg.jpg&quot;);
                  ImageIO.write(img, &quot;jpg&quot;, file);
                  System.out.println(&quot;Image Convertion Completed&quot;);
              }catch(Exception e) {
                  System.out.println(e);
              }
          }
      }


&lt;/textarea&gt;
&lt;br&gt;&lt;br&gt;
By getting Images height and width we can loop into each pixel of the Image and change it. The RGB value of each pixel is stored in p by getRGB(width, height). Each value is extracted through right shift operator p&gt;&gt;16 the right shift here used is a signed right shift operator which will shift the 32 bit pattern to shift right 16 bit which means the last 16 bit has been dropped and the left top bit is converted to zeros. Similarly for green the last eight has been dropped and all the bits are shifted to right and then all left top bits are converted to zeros and in Blue none of the bits has been shifted it remains the same. Each RGB value is subtracted to 255 to get the Negative Image. Alpha is an Intensity value so it remains the same for all pixel values as 255. Again the values are shifted left and the RGB value is set for that pixel. This process continues for every pixel of the Image. 
&lt;br /&gt;&lt;br/&gt;
  

&lt;a id=&quot;head&quot;&gt;Bit-Plane Slicing&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Bit-Plane Slicing is to show or highlight important features of an Image. Most of the time the top most bits are responsible for an important part of an Image. Bit-Plane Slicing which means showing only specific parts of the Image by isolating other pixel values of an Image.
&lt;br/&gt;&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHJnz-oPVOxAHfXOsYks5nIdvwuk-JbmojQUqRDPVu75VO20_FXZTccV6bs6Z7NR-psphsH0QUjGAEF1sKMtAQmLU_Mv-WrEZtRvY2l8-ySOwJD97-fY6PyQNfeT3PY0O5paRed6o2_E3P/s275/autumn_bslice.jpg&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;183&quot; data-original-width=&quot;275&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHJnz-oPVOxAHfXOsYks5nIdvwuk-JbmojQUqRDPVu75VO20_FXZTccV6bs6Z7NR-psphsH0QUjGAEF1sKMtAQmLU_Mv-WrEZtRvY2l8-ySOwJD97-fY6PyQNfeT3PY0O5paRed6o2_E3P/s400/autumn_bslice.jpg&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  

&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot; style=&quot;height:96vh&quot;&gt;
     
      import java.io.*;
      import java.awt.Color;
      import java.awt.image.*;

      import javax.imageio.ImageIO;

      public class bslice {

          public static void main(String args[]) throws IOException{
              File file = new File(&quot;D:\\VS Code\\JAVA\\autumn.jfif&quot;);
              BufferedImage k = ImageIO.read(file);
              System.out.println(&quot;Image Read Completed&quot;);

              for(int i=0; i&lt;k.getHeight(); i++) {
                  for(int j=0; j&lt;k.getWidth(); j++) {

                      int color = k.getRGB(j, i);
                      int Blue = color &amp; 0x80;
                      int Green = (color &amp; 0x80) &gt;&gt; 8;
                      int Red = (color &amp; 0x80) &gt;&gt; 16;
                      Color c = new Color(Red+Green+Blue,Red+Green+Blue,Red+Green+Blue);
                      k.setRGB(j, i, c.getRGB());
                  }
              }
              file = new File(&quot;D:\\VS Code\\JAVA\\autumn_bslice.jpg&quot;);
              ImageIO.write(k, &quot;jpg&quot;, file);
              System.out.println(&quot;Image Write Completed&quot;);
          }
      }
  
&lt;/textarea&gt;
&lt;br&gt;&lt;br&gt;
Here 0x80 represents the Most Significant bit of a 8 bit byte set. Blue = colour &amp; 0x80 which means top most 8 bits remain same all the other bits are converted to zero. Green bits are shifted right here the top most bits are from 8 to 15 they only remain the same all the other bits are converted to zero. Similarly in the Red top most bits are shifted to 16 to 23 all the other bits become zero.
&lt;br /&gt;&lt;br/&gt;  
  
  &lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using JAVA.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/7721338124528669706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/09/image-processing-in-java-read-write-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/7721338124528669706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/7721338124528669706'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/09/image-processing-in-java-read-write-to.html' title='Image Processing in Java - Read, Write, to Black and White, to Gray, to Negative and Bit-Plane Slicing.'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO2IgoUHJxpq4_SMXbBYBQ7GxsawzvsvJN4giuNtORPVe6f6cAxAo8hvlbY1O70qPy9Dm1INjYpJ3ZN0NXNQSRHcV7efQmKaaz1lJ7epYGMGoRMSB2ZzUVNLz7Aglw0EsbBx4fKD2pOi0d/s72-c/autumn_neg.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-4725658788141838482</id><published>2021-08-30T03:33:00.003+05:30</published><updated>2021-09-29T23:34:43.256+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Shuffled Anagrams problem solved in java"/><title type='text'>Round E 2021 Google Kick Start Shuffled Anagrams Problem | Java | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 180vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcvTIc6krZDrtkWH1VIb_ygHtiJCmnVWuxqPENzG8CDfC7SKTOPScjYI_9Tpb_SOLTj1PuIxEnwxmGmoJ28TrCvAgYJfOg1Gqz5Vu_Y3hNiDufqbJvYx263w0w1EWPs2xOgYcRgjIFGadB/s452/Screenshot+%2528323%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;269&quot; data-original-width=&quot;452&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcvTIc6krZDrtkWH1VIb_ygHtiJCmnVWuxqPENzG8CDfC7SKTOPScjYI_9Tpb_SOLTj1PuIxEnwxmGmoJ28TrCvAgYJfOg1Gqz5Vu_Y3hNiDufqbJvYx263w0w1EWPs2xOgYcRgjIFGadB/s400/Screenshot+%2528323%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span id=&quot;para&quot;&gt;
&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br&gt;
Let S be a string containing only letters of the English alphabet. An anagram of S is any string that contains exactly the same letters as S (with the same number of occurrences for each letter), but in a different order. For example, the word kick has anagrams such as kcik and ckki.
&lt;br/&gt;&lt;br/&gt;
Now, let S[i] be the i-th letter in S. We say that an anagram of S, A, is shuffled if and only if for all i, S[i]≠A[i]. So, for instance, kcik is not a shuffled anagram of kick as the first and fourth letters of both of them are the same. However, ckki would be considered a shuffled anagram of kick, as would ikkc.
&lt;br/&gt;&lt;br/&gt;
Given an arbitrary string S, your task is to output any one shuffled anagram of S, or else print IMPOSSIBLE if this cannot be done.  
&lt;br/&gt;&lt;br/&gt;
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow. Each test case consists of one line, a string of English letters.
&lt;br/&gt;&lt;br/&gt;  

&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is a shuffled anagram of the string for that test case, or IMPOSSIBLE if no shuffled anagram exists for that string.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizLdF9g36UHF5Ui-jsU90pCAQwclT7O0i0c2xFqD4NLiEAUhMBu13ZZMq5-wGHk0kOrRdEV8YPG2SppMB2UV81XiWT3TV74oSP7Ra8Ka9BPmBEAwpYlAvGThC2Z1uNckSGHkL9Opq-ltxH/s530/Screenshot+%2528320%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;450&quot; data-original-height=&quot;191&quot; data-original-width=&quot;530&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizLdF9g36UHF5Ui-jsU90pCAQwclT7O0i0c2xFqD4NLiEAUhMBu13ZZMq5-wGHk0kOrRdEV8YPG2SppMB2UV81XiWT3TV74oSP7Ra8Ka9BPmBEAwpYlAvGThC2Z1uNckSGHkL9Opq-ltxH/s400/Screenshot+%2528320%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
In test case #1, tarts is a shuffled anagram of start as none of the letters in each position of both strings match the other. Another possible solution is trsta (though you only need to provide one solution). However, in test case #2, there is no way of anagramming jjj to form a shuffled anagram, so IMPOSSIBLE is printed instead.&lt;br/&gt;

&lt;br/&gt;&lt;br/&gt;
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;  

&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot;&gt;
     
    import java.util.*;

    public class Solution { 
        public static void main(String[] args) throws Exception{
            Scanner sc =  new Scanner(System.in);
            int t = sc.nextInt();
            for(int i=1; i&lt;=t; i++) {
                String n = sc.next();
                Character a[] = new Character[n.length()];
                for(int j=0; j&lt;n.length(); j++) {
                    a[j] = n.charAt(j);
                }
                System.out.printf(&quot;Case #%d: %s\n&quot;,i,str(n,a));
            }

        }

        private static Object str(String n, Character[] a) {

            int count=0;

            for(int m=0; m&lt;n.length(); m++) {
                int tempcount = 0;

                for(int l=0; l&lt;n.length(); l++) {
                    if(a[m] == a[l]) tempcount++;
                }
                if(tempcount &gt; count) {
                    count = tempcount;
                }
            }
            if(count &gt; n.length()/2) {
                return &quot;IMPOSSIBLE&quot;;
            }
            return again(n);
        }

        private static String again(String n) {

            char a[] = n.toCharArray();
            for (int i = 0; i &lt; a.length; i++) {
                for (int j = 0; j &lt; a.length; j++) {
                    if (a[i] != a[j] &amp;&amp; a[i] != n.charAt(j) &amp;&amp; a[j] != n.charAt(i)) {
                        char tmp = a[i];
                        a[i] = a[j];
                        a[j] = tmp;
                        break;
                    }
                }
            }
            return new String(a);
        }

    }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;
  &lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using JAVA.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/4725658788141838482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/08/round-e-2021-google-kick-start-shuffled.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4725658788141838482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4725658788141838482'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/08/round-e-2021-google-kick-start-shuffled.html' title='Round E 2021 Google Kick Start Shuffled Anagrams Problem | Java | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcvTIc6krZDrtkWH1VIb_ygHtiJCmnVWuxqPENzG8CDfC7SKTOPScjYI_9Tpb_SOLTj1PuIxEnwxmGmoJ28TrCvAgYJfOg1Gqz5Vu_Y3hNiDufqbJvYx263w0w1EWPs2xOgYcRgjIFGadB/s72-c/Screenshot+%2528323%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-4854215310825943548</id><published>2021-08-28T01:10:00.001+05:30</published><updated>2022-02-21T22:32:03.628+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Tracing matrix program"/><title type='text'>3x3 Matrix Multiplication Tracing in Java </title><content type='html'>&lt;html&gt;
  &lt;head&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    #b{
       color:black; 
       align-items: center;
      font-size: medium;
        font-family:sans-serif;
      }
      p {
        align-items: center;
        color: blue;
        font-family:sans-serif;
        font-size: medium;
      }
      textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 100vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;
padding: 10px 0;
}
      &lt;/style&gt;
    &lt;/head&gt;
  
  &lt;body&gt;
    &lt;h2 style=&quot;color:red; font-weight:bold;&quot;&gt;MATRIX MULTIPLICATION TRACING IN JAVA&lt;/h2&gt;
    &lt;p&gt;
      Tracing which means to trace the code and find the workflow of the program especially for loops and other complicated conditions. Tracing is one of the important parts of Software Developing. You can trace a code by written format or with the help of a print statement also depending upon your comfort.
      &lt;/p&gt;
    
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2OX0ZMDps7Rx62muJJHYVDUsJHPjpIwJERKEYpU6WUYLANe91GW5TmqoDhBq957N902PWhI9h-jo9lJIC6nDb1dRfgRqjpP0qtHdf_zlYHx9xIxZSU7lPzN3RCCuIpEvZEBpPtSOq44rN/s300/download.jpg&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;168&quot; data-original-width=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2OX0ZMDps7Rx62muJJHYVDUsJHPjpIwJERKEYpU6WUYLANe91GW5TmqoDhBq957N902PWhI9h-jo9lJIC6nDb1dRfgRqjpP0qtHdf_zlYHx9xIxZSU7lPzN3RCCuIpEvZEBpPtSOq44rN/s400/download.jpg&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Matrix Multiplication Tracing&lt;/h3&gt;
    &lt;span id=&quot;b&quot;&gt;
      Declare a 2-D Array to get the input for 1st Matrix and another one to get the input 2nd Matrix from the user or you can declare it directly with the value to be stored. And the 3rd Array is to store the value of Matrix Multiplication of 1st and 2nd Matrix.
      &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
&lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Program&lt;/h3&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:160vh&quot;&gt;
      
      
        //PROGRAM

    import java.util.Scanner;

    public class MatrixMultiplication {

        public static void main(String[] args) {

            Scanner sc = new Scanner(System.in);

            int[][] a = new int[9][9];

            int[][] b = new int[9][9];

            int[][] c = new int[9][9];

            //FIRST MATRIX

            for(int i=0; i&lt;3; i++) {
                for(int j=0; j&lt;3; j++) {
                System.out.println(&quot;Enter the value for First Matrix row&quot;+(i+1)+&quot;column&quot;+(j+1)+&quot;: &quot;);
                a[i][j] = sc.nextInt();

                }
            }

            //SECOND MATRIX
            for(int i=0; i&lt;3; i++) {
                for(int j=0; j&lt;3; j++) {
                System.out.println(&quot;Enter the value for Second Matrix row&quot;+(i+1)+&quot;column&quot;+(j+1)+&quot;: &quot;);

                b[i][j] = sc.nextInt();

                }
            }


            for(int i=0; i&lt;3; i++) {
                for(int j=0; j&lt;3; j++) {
                    c[i][j] = 0;                          // this line
                    for(int k=0; k&lt;3; k++) {
                    c[i][j] += a[i][k] *b[k][j] ;
                    }
                }
            }

            System.out.println(&quot;Matrix Multiplication: &quot;);
            for(int m=0; m&lt;3; m++) {
                System.out.println(&quot;&quot;);
                for(int f=0; f&lt;3; f++) {
                    System.out.print(c[m][f]+&quot;  &quot;);
                }
            }

        }

    }

&lt;/textarea&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;span id=&quot;b&quot;&gt;
    Note: Arrays always begins with index zero. It is a 3x3 matrix so you have to declare the arrays index as 9 or above. While using an array with loops ends up with array out of bounds error it&#39;s because variable value must be exceeding array index value. c[i][j]=0; this line in this program helps us to reset the value to zero; the details are shown below in the Tracing part.
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Tracing Matrix 1&lt;/h3&gt;
      
    &lt;br&gt;
    &lt;span id=&quot;b&quot;&gt;
    Here two for loops has been used to index a value in a unique position every time and the outer loop iterates for three times and the inner loop iterates for three times for every iteration of the outer loop which makes a total of 9 times. In the tracing part the i denotes the row and j denotes the column of the matrix and A(i,j) is the value entered by the user on the ith row and jth column.
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:112vh&quot;&gt;
   
    TRACING MATRIX 1


      for(int i=0; i&lt;3; i++) {
			for(int j=0; j&lt;3; j++) {
		    System.out.println(&quot;Enter the value for First Matrix row&quot;+(i+1)+&quot;column&quot;+(j+1)+&quot;: &quot;);
		    a[i][j] = sc.nextInt();
		
			}
		}

      

      i  j  A(i,j)                 
   
      0  0   1                
     
      0  1   2                

      0  2   3               

      1  0   4               

      1  1   5                

      1  2   6                

      2  0   7               

      2  1   8                

      2  2   9                

      &lt;/textarea&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;span id=&quot;b&quot;&gt;
    Here both the i and j are starts with zero, after getting the value from user i remains the same and the inner loop will increment by 1 because of the j++ condition it will increment the value of variable by 1, now the i value remains the same and j value will be 1 once the value has been entered the i remains the same because the inner loop hasn&#39;t failed yet. Once the inner loop fails it will go to the outer loop and the outer loop will increment by 1 this process continues until the outer loop fails. In this case after the 9th iteration it breaks.
    &lt;/span&gt;
&lt;br/&gt;&lt;br/&gt;
                                     
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Tracing Matrix 2&lt;/h3&gt;
   
    &lt;br&gt;
    
    &lt;span id=&quot;b&quot;&gt;
    Second Matrix which is the same as the first one. This one also iterates for 9 times and it is the same as above for loop but the values are stored in a different 2-D Array.
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:112vh&quot;&gt;
      
           TRACING MATRIX 2


      for(int i=0; i&lt;3; i++) {
			for(int j=0; j&lt;3; j++) {
		    System.out.println(&quot;Enter the value for First Matrix row&quot;+(i+1)+&quot;column&quot;+(j+1)+&quot;: &quot;);
		    a[i][j] = sc.nextInt();
		
			}
		}


      i  j  B(i,j)      
   
      0  0    1
     
      0  1    0

      0  2    0

      1  0    0

      1  1    1

      1  2    0

      2  0    0

      2  1    0

      2  2    1

&lt;/textarea&gt;
      
&lt;br/&gt;&lt;br/&gt;
                                     
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Tracing Matrix Multiplication&lt;/h3&gt;
   
    &lt;br&gt;
    &lt;span id=&quot;b&quot;&gt;
    In Matrix Multiplication the 1st row of the 1st matrix will be multiplied to the 2nd matrix 2nd column and then added and the value is stored in the 0th row and 0th column, similarly all the other rows and columns are done in the same way. For that here we are having 3 for loops to do the job. c[i][j]=0 it will set the value to zero after every time it exits the inner loop the purpose of doing this is to prevent the value of previous sum added to the next one it will significantly change all other outputs. 

    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:140vh&quot;&gt;
      
        TRACING MATRIX MULTIPLICATION


              for(int i=0; i&lt;3; i++) {
                    for(int j=0; j&lt;3; j++) {
                        c[i][j] = 0;
                        for(int k=0; k&lt;3; k++) {
                        c[i][j] += a[i][k] *b[k][j] ;
                        }
                    }
                }


        i     j     c(i,j)     k     c(i,j)

        0     0       0        0     1 * 1 = 1

        0     0       1        1     2 * 0 = 0 + 1 = 1

        0     0       1        2     3 * 0 = 0 + 1 = 1 = c[0][0]

        0     1       0        0     1 * 0 = 0

        0     1       0        1     2 * 1 = 0 + 2 = 2

        0     1       2        2     3 * 0 = 0 + 2 = 2 = c[0][1]

        0     2       0        0     1 * 0 = 0

        0     2       0        1     2 * 0 = 0 + 0 = 0

        0     2       0        2     3 * 1 = 3 + 0 = 3 = c[0][2]

        1     0       0        0     4 * 1 = 4

        1     0       4        1     5 * 0 = 0 + 4 = 4

        1     0       4        2     6 * 0 = 0 + 4 = 4 = c[1][0]

        1     1       0        0     4 * 0 = 0

        1     1       0        1     5 * 1 = 5 + 0 = 5

        1     1       5        2     6 * 0 = 0 + 5 = 5 = c[1][1]

        1     2       0        0     4 * 0 = 0

        1     2       0        1     5 * 0 = 0 + 0 = 0

        1     2       0        2     6 * 1 = 6 + 0 = 6 = c[1][2]

        2     0       0        0     7 * 1 = 7

        2     0       7        1     8 * 0 = 0 + 7 = 7

        2     0       7        2     9 * 0 = 0 + 7 = 7 = c[2][0]

        2     1       0        0     7 * 0 = 0

        2     1       0        1     8 * 1 = 8 + 0 = 8

        2     1       8        2     9 * 0 = 0 + 8 = 8 = c[2][1]

        2     2       0        0     7 * 0 = 0

        2     2       9        1     8 * 0 = 0 + 0 = 0

        2     2       9        2     9 * 1 = 9 + 0 = 9 = c[2][2]
                                  
&lt;/textarea&gt;      
&lt;br&gt;&lt;br&gt;
    &lt;span id=&quot;b&quot;&gt;
    Once the loop enters the outer loop it will enter the 1st inner loop and then it will iterate through the 2nd inner loop each loop iterates 3 times every time. Hence the for loop will iterate upto 27 times and then terminate. Here you can clearly see that c(i,j) is set to 0 every time it exits from the inner loop. c[i][j] += a[i][k] *b[k][j]; this line of code helps us to multiply and add and store value in c[i][j] by changing A matrices column and B matrices row and then adding to the value stored in c[i][j]. As I mentioned earlier you can also use System.out.print(&quot;&quot;); to trace a program effectively.
    &lt;/span&gt;
&lt;br/&gt;
      &lt;br&gt;
&lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using Java.&lt;/a&gt;
  &lt;br&gt;&lt;br&gt;
&lt;/body&gt;
  &lt;/html&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/4854215310825943548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/08/3x3-matrix-multiplication-tracing-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4854215310825943548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4854215310825943548'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/08/3x3-matrix-multiplication-tracing-in.html' title='3x3 Matrix Multiplication Tracing in Java '/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2OX0ZMDps7Rx62muJJHYVDUsJHPjpIwJERKEYpU6WUYLANe91GW5TmqoDhBq957N902PWhI9h-jo9lJIC6nDb1dRfgRqjpP0qtHdf_zlYHx9xIxZSU7lPzN3RCCuIpEvZEBpPtSOq44rN/s72-c/download.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-6580528322788105982</id><published>2021-08-07T22:50:00.004+05:30</published><updated>2022-02-21T22:40:14.684+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="css and js."/><category scheme="http://www.blogger.com/atom/ns#" term="Fully functioning top navigation bar using html"/><title type='text'>Full-Fledged Responsive Top Navigation Bar using Html, Css and Js.</title><content type='html'>&lt;html&gt;
  &lt;head&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    #b{
       color:black; 
       align-items: center;
      font-size: medium;
        font-family:sans-serif;
      }
      p {
        align-items: center;
        color: blue;
        font-family:sans-serif;
        font-size: medium;
      }
      textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 100vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;
padding: 10px 0;
}
      &lt;/style&gt;
    &lt;/head&gt;
  
  &lt;body&gt;
    &lt;h2 style=&quot;color:red; font-weight:bold;&quot;&gt;FULLY DEVELOPED TOP NAVIGATION BAR OR MAIN MENU USING HTML, CSS AND JS&lt;/h2&gt;
    &lt;p&gt;
      What is a Fully Fledged Navigation Bar ? Nothing but a navigation bar which is easily accessible in a variety of devices like smartphones, Tablets etc. Navigation Bar which is responsible for creating HTML, Css and Js.
      &lt;/p&gt;
    
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwS5OoUdfxXUvkmDKiH-iC3duzEVWN4O9Aqa47ORZ4pL53MrrfwaVphn6myv9hQrXhib_uX5Cotwohw_tSVON0j9Xs5BVzGkpZCfjZ0VAwO8zmsLMYOK55b7EmWB90T6i8zX9LeKVb533r/s614/Screenshot+%2528219%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;400&quot; data-original-height=&quot;614&quot; data-original-width=&quot;338&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwS5OoUdfxXUvkmDKiH-iC3duzEVWN4O9Aqa47ORZ4pL53MrrfwaVphn6myv9hQrXhib_uX5Cotwohw_tSVON0j9Xs5BVzGkpZCfjZ0VAwO8zmsLMYOK55b7EmWB90T6i8zX9LeKVb533r/s400/Screenshot+%2528219%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;  
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;HTML&lt;/h3&gt;
    &lt;span id=&quot;b&quot;&gt;
      In the HTML file you have to include what are all the main menu items using list tag which will help us to list items while we open it in mobile screens or you can include with a simple &lt;a&gt;&lt;/a&gt; tag or any other tags but it will be a difficult one to handle in CSS or you have to copy and create another main menu items it will increase code size. Next one we have to consider while we create a navigation bar is toggle icon. To include toggle icons you have to use Font Awesome or any other open source icons based on CSS. All you have to do is select whatever icon you want from the Font Awesome and add it to your HTML file. And all of the above you have to link your CSS and JS files and also you have include Font Awesome link =&gt; &lt;a href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot;&gt;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&lt;/a&gt;.
      &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
&lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;cms.html File&lt;/h3&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:141vh&quot;&gt;
      
    &lt;!DOCTYPE html&gt;
    &lt;html lang=&quot;en&quot;&gt;
    &lt;head&gt;
        &lt;meta charset=&quot;UTF-8&quot;&gt;
        &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
        &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
        &lt;title&gt;Know About&lt;/title&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css&quot;&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;cms.css&quot;&gt;
        &lt;script src=&quot;cms.js&quot;&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body id=&quot;body&quot;&gt;

    &lt;div class=&quot;container&quot;&gt;
        &lt;!-- TOP NAVIGATION BAR     --&gt;
        &lt;div class=&quot;top-nav-bar&quot; id=&quot;top-nav-bar&quot;&gt;
            &lt;!-- WEBSITE NAME OR LOGO --&gt;
            &lt;div class=&quot;web-name&quot; id=&quot;web-name&quot; title=&quot;website&quot;&gt;
               &lt;a&gt;Know About&lt;/a&gt; &lt;br&gt;
               &lt;a style=&quot;color: silver; font-size: 10px;&quot;&gt;page to know about Internet&lt;/a&gt; 
            &lt;/div&gt;
            &lt;!-- MAIN MENU --&gt;
            &lt;ul class=&quot;main-menu&quot; id=&quot;main-menu&quot; title=&quot;main menu&quot;&gt;
                &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;home page&quot;&gt;HOME&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;user profile page&quot;&gt;PROFILE&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;registration page&quot;&gt;REGISTER&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;availability checking&quot;&gt;AVAILABILITY&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;statistical details&quot;&gt;STATISTICS&lt;/a&gt;&lt;/li&gt;
                &lt;!-- &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;contact form&quot;&gt;CONTACT US&lt;/a&gt;&lt;/li&gt; --&gt;
                &lt;li&gt;&lt;a href=&quot;#&quot; title=&quot;login&quot;&gt;LOG IN / SIGN UP&lt;/a&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;a href=&quot;javascript:void(0);&quot; id=&quot;mob-nav-open&quot; class=&quot;icon&quot; onclick=&quot;mobnav()&quot;&gt;
            &lt;i class=&quot;fa fa-bars fa-lg&quot;&gt;&lt;/i&gt;
            &lt;/a&gt;
            &lt;a href=&quot;javascript:void(0);&quot; id=&quot;mob-nav-close&quot; class=&quot;icon&quot; onclick=&quot;mobnavclose()&quot;&gt;
                &lt;i class=&quot;fas fa-times fa-lg&quot;&gt;&lt;/i&gt;
                &lt;/a&gt;
        &lt;/div&gt; 
    &lt;/div&gt;

    &lt;/body&gt;
    &lt;/html&gt;
&lt;/textarea&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;span id=&quot;b&quot;&gt;
    You have to always put that italic tag copied from Font Awesome inside a class named icon if you change the name of the class icon it won&#39;t appear and the second fa (fa-lg) in italic tag is used to determine the size of the icon you are going to use. And the javascript(0) inside that hypertext is used to show mouse pointer while you hover on that icon or a normal mouse icon will appear and I am pretty sure you have noticed many times when you hover mouse on certain images &quot;javascript:void(0);&quot; is displayed in the left-bottom of the page.
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;CSS&lt;/h3&gt;
    
    &lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzQKfEzMcwYw5cU1vnyxhCShIRuTRuSHgQe4-GoVi6lR1ypxvpcFSaEvUbSDebSsmlh173Q5uBxDOa3rMqK0VtfXBsXc1EQ-L8-fwIxkpB0zD5cZAlpRr0YOWra7xbEMi8x3tfwPeXwN8O/s613/Screenshot+%2528220%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;400&quot; data-original-height=&quot;613&quot; data-original-width=&quot;344&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzQKfEzMcwYw5cU1vnyxhCShIRuTRuSHgQe4-GoVi6lR1ypxvpcFSaEvUbSDebSsmlh173Q5uBxDOa3rMqK0VtfXBsXc1EQ-L8-fwIxkpB0zD5cZAlpRr0YOWra7xbEMi8x3tfwPeXwN8O/s400/Screenshot+%2528220%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
    &lt;br&gt;
    &lt;span id=&quot;b&quot;&gt;
    The Cascading Style sheet is used to style our navigation bar. Here you have to align items according to the device&#39;s width. For that we are going to use @media rule. Using this you can set maximum and minimum width or height, by this you can decide where the effect has to apply. For Example: once the width of the screen is reduced to mobile screen you can&#39;t show the entire navigation bar for that only you have to set the main menu&#39;s display to none and we are going to use a toggle icon acting as a button. Once the toggle button is clicked we are going to list main menu items vertically. 
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;    
    
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;cms.css File&lt;/h3&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:180vh&quot;&gt;
   
    *{
        background-color: black;
        transition: all .20s ease;
        height: auto;
        width: auto;
    }

    #top-nav-bar{
        border-bottom:1px solid red;
        border-top:1px solid red;
        padding: 10px;
        text-align: center;
        font-family:FontAwesome;
        font-weight:400;
        font-size:12px;
        width: auto;
        display: flex;
        height: auto;
        box-sizing: border-box;
        position: relative;
        margin: 0 auto;
        overflow: visible;
        justify-content: space-between;
        z-index: 10;
    }

    #web-name{
        float:left;
        padding-left: 105px;
        font-size:16px;
        display: block;
    }
    #main-menu{
        float: right;
        padding-left:100px;
        display: block;
    }

    a{
        padding-left: 20px;
        text-decoration: none;
        color: white;
        /* font-weight: bold; */
    }
    a:hover{
        color: red;
    }
    li{
        display: inline-block;
    }
    #mob-nav-open, #mob-nav-close{
        top:20px;
        right: 10px;
        position: absolute;
        padding:0 0 0 20px;
        display: none;
        transition: 2s;
    }

    @media screen and (max-width:924px) {

        #web-name{
            padding-left: 80px;
        }
        #main-menu{
            padding-left: 75px;
        }
    }
    @media  screen and (max-width:880px){

        #web-name{
            padding-left: 55px;
        }
        #main-menu{
            padding-left: 50px;
        }
    }
    @media  screen and (max-width:826px){

        #web-name{
            padding-left: 30px;
        }
        #main-menu{
            padding-left: 25px;
        }
    }
    @media  screen and (max-width:776px){

        #web-name{
            padding-left: 0px;
        }
        #main-menu{
            display:none;
        }
        #mob-nav-open{
            display: block;
        }
        #top-nav-bar{
            display: block;
        }
        #top-nav-bar{
            flex-direction: column;
            align-items: flex-start;
            display: flex;

        }
        #main-menu{
            width: 100%;
            height: 100%;
            transition: 1s ease;
            z-index: 20;
            text-align: left;
        }
        li{
            display:block;
            padding: 10px;
            border-top: 1px solid red;
            font-family: FontAwesome;
            font-size: 12px;
            font-weight: bold;
        }
        li &gt; a{
            display: inline-block;
            width: 98%;
        }
    }
      &lt;/textarea&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;span id=&quot;b&quot;&gt;
    Not only to adjust to the screen&#39;s width but also to change background colour, text colour, font-family, padding which is similar to margin; these are some of the attributes used in our style sheet. Display which is one of the important attribute which helps us to set an element to none or to a block state. For Example: In the end of our stylesheet display is set to inline-block for an element a inside li and the width is set to 98% with this clickable width of a main menu item&#39;s will be 98% of screen&#39;s width.
    &lt;/span&gt;
&lt;br/&gt;&lt;br/&gt;
                                     
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;JS&lt;/h3&gt;
    &lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOXjrKueZm0ApX5QDn0st4sQ_yRlnQvUlh_-RCLsDguEWybdD1A7swY54nm3SYfrEmudEBfYRewnx3HrcCdKZ9EKW7bxJoM6AfNpBlkhUR-EFGL91Fyngct-vNwrFEUi96w7_ZDOwMn1uY/s768/Screenshot+%2528210%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;594&quot; data-original-width=&quot;768&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOXjrKueZm0ApX5QDn0st4sQ_yRlnQvUlh_-RCLsDguEWybdD1A7swY54nm3SYfrEmudEBfYRewnx3HrcCdKZ9EKW7bxJoM6AfNpBlkhUR-EFGL91Fyngct-vNwrFEUi96w7_ZDOwMn1uY/s400/Screenshot+%2528210%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
    &lt;br&gt;
    
    &lt;span id=&quot;b&quot;&gt;
    JavaScript helps us to show main menu item&#39;s in mobile screen with the help of an onclick event. We have used two onclick events in each one of the toggle icons, one is for the main menu to appear, another one to disappear and the alignments have already been specified on the cascading style sheet with the help of @media rule. Every time the toggle button is clicked that toggle icon will disappear and another toggle icon will appear.
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;cms.js File&lt;/h3&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:45vh&quot;&gt;
      
           // DISPLAY TOP MOBILE NAVIGATION
           // HIDE TOP MOBILE NAVIGATION TOGGLE
      function mobnav(){
          var a = document.getElementById(&quot;main-menu&quot;);
          var open = document.getElementById(&quot;mob-nav-open&quot;);
          var close = document.getElementById(&quot;mob-nav-close&quot;);
          open.style.display =&quot;none&quot;;
          close.style.display =&quot;block&quot;;
          if(a.style.display === &quot;block&quot;){
              a.style.display = &quot;none&quot;;
          }
          else{
          a.style.display = &#39;block&#39;;
          }
      }
          // OPEN TOP MOBILE NAVIGATION TOGGLE
      function mobnavclose(){
          var a = document.getElementById(&quot;main-menu&quot;);
          var open = document.getElementById(&quot;mob-nav-open&quot;);
          var close = document.getElementById(&quot;mob-nav-close&quot;);
          open.style.display = &quot;&quot;;
          close.style.display = &quot;none&quot;;
          a.style.display = &quot;&quot;;
      }
&lt;/textarea&gt;    
    
      &lt;br&gt;
&lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using Java.&lt;/a&gt;
  &lt;br&gt;&lt;br&gt;

      
&lt;/body&gt;
  &lt;/html&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/6580528322788105982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/08/full-fledged-responsive-top-navigation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6580528322788105982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6580528322788105982'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/08/full-fledged-responsive-top-navigation.html' title='Full-Fledged Responsive Top Navigation Bar using Html, Css and Js.'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwS5OoUdfxXUvkmDKiH-iC3duzEVWN4O9Aqa47ORZ4pL53MrrfwaVphn6myv9hQrXhib_uX5Cotwohw_tSVON0j9Xs5BVzGkpZCfjZ0VAwO8zmsLMYOK55b7EmWB90T6i8zX9LeKVb533r/s72-c/Screenshot+%2528219%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-6589886240415684169</id><published>2021-07-21T21:46:00.005+05:30</published><updated>2022-02-21T22:50:44.165+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Calculate the total amount for purchased items from the menu using Html and java script"/><title type='text'>Billing Software for Shops using Html and Java Script | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;

&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 165vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;br /&gt;

&lt;span id=&quot;para&quot;&gt;
Billing Software for Shops using Html and Java Script.
&lt;/span&gt;

&lt;br /&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfeMkAkx03Bq38lao-KHk1WLenaZBSISg7QUGkwHKj51OgAfbiQXkfw3Af673ChiHcGg2PTaK_w3jVq5y50mEwDs7CBRM2wZWYQXjb3HW3pJUcyWOg_gZ9zl9FCDQm1Muw1gaHF5-6NsD_/s968/Screenshot+%2528146%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;600&quot; data-original-height=&quot;605&quot; data-original-width=&quot;968&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfeMkAkx03Bq38lao-KHk1WLenaZBSISg7QUGkwHKj51OgAfbiQXkfw3Af673ChiHcGg2PTaK_w3jVq5y50mEwDs7CBRM2wZWYQXjb3HW3pJUcyWOg_gZ9zl9FCDQm1Muw1gaHF5-6NsD_/s600/Screenshot+%2528146%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;

&lt;h3 id=&quot;head&quot;&gt; 
Do you want to know how to get value of a selected item in java script ?
&lt;/h3&gt;
  
&lt;p id=&quot;para&quot;&gt;
If you want to know how to get the value of a selected item from a multiple choice list you are in the correct place to learn. You must have to read the post at least once. Value has been collected from the form using elements. To know further, continue reading. Have a nice day.
&lt;/p&gt;
&lt;br/&gt;
&lt;h3 id=&quot;head&quot;&gt; 
Create Menu Item
&lt;/h3&gt;  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCSStPyDBu0IC_uP9VW6JNRB-78sbqYZFtPmVygePc07D1cDmoy8f6zr-rUhymRfRVJ0Ab8QhSfQ-3MQ-FhGohv3fjcaKdAn_vNswMqI-paMM1TTcbTJICcZCt5eYLEFrThoSpejjzbpcE/s511/Screenshot+%2528140%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;262&quot; data-original-width=&quot;511&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCSStPyDBu0IC_uP9VW6JNRB-78sbqYZFtPmVygePc07D1cDmoy8f6zr-rUhymRfRVJ0Ab8QhSfQ-3MQ-FhGohv3fjcaKdAn_vNswMqI-paMM1TTcbTJICcZCt5eYLEFrThoSpejjzbpcE/s400/Screenshot+%2528140%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;textarea style=&quot;height: 104vh;&quot; wrap=&quot;off&quot;&gt;
    
    &lt;form name=&quot;f1&quot;&gt;&lt;h3&gt;SELECT MENU ITEMS OF YOUR CHOICE&lt;/h3&gt;&lt;br/&gt;
    &lt;table&gt;&lt;tr&gt;
    &lt;td&gt;MAJOR DISHES&lt;br&gt;
    &lt;select name=&quot;s1&quot; MULTIPLE onclick=&quot;pick()&quot;&gt;
        &lt;option value=&quot;MC BURGER=&gt;80&quot;&gt;MC BURGER&lt;/option&gt;
        &lt;option value=&quot;FISH FILLETS=&gt;70&quot;&gt;FISH FILLETS&lt;/option&gt;
        &lt;option value=&quot;CHICKEN BURGER=&gt;65&quot;&gt;CHICKEN BURGER&lt;/option&gt;
        &lt;option value=&quot;MC CHICKEN=&gt;75&quot;&gt;CHICKEN BURGER&lt;/option&gt;
        &lt;option value=&quot;GRILLED CHICKEN DELUXE=&gt;90&quot;&gt;CHICKEN BURGER&lt;/option&gt;
        &lt;/select&gt;&lt;/td&gt;      
    
    &lt;td&gt;STARTERS&lt;br&gt;
        &lt;select name=&quot;s2&quot; MULTIPLE onclick=&quot;pick()&quot;&gt;
        &lt;option value=&quot;FRENCH FRIES=&gt;40&quot;&gt;FRENCH FRIES&lt;/option&gt;
        &lt;option value=&quot;NUGGETS=&gt;50&quot;&gt;NUGGETS&lt;/option&gt;
        &lt;option value=&quot;HASH BROWNS=&gt;50&quot;&gt;HASH BROWNS&lt;/option&gt;
        &lt;option value=&quot;SALADS=&gt;30&quot;&gt;SALADS&lt;/option&gt;
        &lt;option value=&quot;LOADED FRIES=&gt;45&quot;&gt;LOADED FRIES&lt;/option&gt; 
        &lt;/select&gt;&lt;/td&gt;

        &lt;td&gt;MISCELLANEOUS&lt;br&gt;
            &lt;select name=&quot;s3&quot; onclick=&quot;pick()&quot;&gt;
            &lt;option value=&quot; &quot;&gt;Select&lt;/option&gt;
            &lt;option value=&quot;MILK SHAKES=&gt;35&quot;&gt;MILK SHAKES&lt;/option&gt;
            &lt;option value=&quot;SOFT DRINKS=&gt;40&quot;&gt;SOFT DRINKS&lt;/option&gt;
            &lt;option value=&quot;COFFEE AND TEA=&gt;30&quot;&gt;COFFEE AND TEA&lt;/option&gt;
            &lt;option value=&quot;ALCOHOLIC BEVARAGES=&gt;50&quot;&gt;ALCOHOLIC BEVARAGES&lt;/option&gt;
            &lt;/select&gt;&lt;/td&gt;    
     &lt;/tr&gt;
     &lt;/table&gt;
     &lt;/form&gt; 
&lt;/textarea&gt;
&lt;br /&gt;
&lt;span id=&quot;para&quot;&gt;
You have to create a form inside that you can use whatever type like checkboxes or radio buttons or any other you want, here I am using select tag choice list for both Multiple and single options. When you use Multiple in the select tag you can select Multiple options and the default one is to select a single option. Onclick event pick() is to show the selected options from the menu. For that you have to create a text view to show the selected list of Items.
&lt;/span&gt;
&lt;br /&gt;&lt;br/&gt;
&lt;h3 id=&quot;head&quot;&gt; 
Create Text Area
&lt;/h3&gt;    
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCS8T2xgfbrR9qqBOqJiwUbS8Fyzoyc9lRKlubKCF7cskOq_oPG83d5Gy8Yf4prDcZOiwJwdTszoNmou4g2rMOKexDURjiOp4NPAenRduidvsH1Qpw_PUuDDlmruW1951tBCw06tt3JAlx/s388/Screenshot+%2528141%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;219&quot; data-original-width=&quot;388&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCS8T2xgfbrR9qqBOqJiwUbS8Fyzoyc9lRKlubKCF7cskOq_oPG83d5Gy8Yf4prDcZOiwJwdTszoNmou4g2rMOKexDURjiOp4NPAenRduidvsH1Qpw_PUuDDlmruW1951tBCw06tt3JAlx/s400/Screenshot+%2528141%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
  
&lt;textarea style=&quot;height: 20vh;&quot; wrap=&quot;off&quot; readonly&gt;
  
     The Items Selected From Menu Are &lt;br/&gt;
     &lt;textarea name=&quot;ta&quot; rows=&quot;10&quot; cols=&quot;50&quot;/&gt;&lt;br/&gt;
     &lt;input name=&quot;b1&quot; type=&quot;button&quot; value=&quot;TOTAL COST&quot; onclick=&quot;cal()&quot;/&gt;
     &lt;input name=&quot;b2&quot; type=&quot;button&quot; value=&quot;CLEAR&quot; onclick=&quot;clr()&quot;/&gt;
&lt;/textarea&gt;
&lt;br /&gt;
&lt;span id=&quot;para&quot;&gt;
Text area has been created using textarea tag widely used to get information from users like plain text and Total Cost button is to trigger the event cal() to calculate the total amount of Item purchased from the menu and Clear button is used to clear the text area box using onclick event clr().
&lt;/span&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;h3 id=&quot;head&quot;&gt; 
Pick Items From Menu
&lt;/h3&gt;  
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMTWTwWKFhTFlwQUukviqgrHzPBIdcQnaBHUFpEjhvEQmlO-phhfRHLs5AmXiTJM9GRRKA6YkFD92ay2Xmbb2v3ua4EPrEGCcMLptpccnK1EWqsPIHzHiwJrrS5pUScVeVwshbH6fFDifS/s488/Screenshot+%2528142%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;343&quot; data-original-width=&quot;488&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMTWTwWKFhTFlwQUukviqgrHzPBIdcQnaBHUFpEjhvEQmlO-phhfRHLs5AmXiTJM9GRRKA6YkFD92ay2Xmbb2v3ua4EPrEGCcMLptpccnK1EWqsPIHzHiwJrrS5pUScVeVwshbH6fFDifS/s400/Screenshot+%2528142%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
  
&lt;textarea style=&quot;height: 55vh;&quot; wrap=&quot;off&quot;&gt;
  
    function pick()
    {
       var z=&quot; &quot;;
       for(i=0;i&lt;3;i++)
       {
           for(j=0;j&lt;f1.elements[i].length;j++)
           {
               if(f1.elements[i][j].selected)
               {
                   var y=f1.elements[i].options[j].value;
                   z=z+&quot;\n&quot;+y;
                   f1.elements[3].value=z;
               }
           }
       }
    }
&lt;/textarea&gt;
&lt;br /&gt;
&lt;span id=&quot;para&quot;&gt;
Pick function is used to show the selected Items from the Menu in the textarea. Variable z has been created to store the value selected from the menu and add menu items. Here f1 is the form name and elements[] which is used to select a particular field from the form and always elements start from 0. Here select tag named &quot;s1&quot; = element zero, select tag named &quot;s2&quot; = first element, select tag named &quot;s3&quot; = second element, textarea = 3rd one and the total cost and clear button are the 4th and 5th elements. First for loop is to get the selected items from the first 3 elements and the Second for loop is to know how many items are there in each element. For Example To know how many options are there in the first select tag. And the if is used to check whether the option is selected, if true it will get the value from that element and stored or added to the z. Atlast you have to show the selected options in the textarea with elements, As I mentioned earlier the 3rd element is textarea.
&lt;/span&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;h3 id=&quot;head&quot;&gt; 
Calculate Total Amount
&lt;/h3&gt;    
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD6PmCUzQ7a_iOfo19jZl_T7nf6ii8yoQegQNsx9lLSTkgsl93x48tLA7XvNXG6VpQCrqZfsrz1IQdHsw6Mt5TSqLhcW_jttwjkSHO4uMPdJDv032L9ohhAccfDUnAVn8EmKGDVgX-GBTS/s695/Screenshot+%2528147%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;380&quot; data-original-width=&quot;695&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD6PmCUzQ7a_iOfo19jZl_T7nf6ii8yoQegQNsx9lLSTkgsl93x48tLA7XvNXG6VpQCrqZfsrz1IQdHsw6Mt5TSqLhcW_jttwjkSHO4uMPdJDv032L9ohhAccfDUnAVn8EmKGDVgX-GBTS/s400/Screenshot+%2528147%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
  
&lt;textarea style=&quot;height: 77vh;&quot; wrap=&quot;off&quot;&gt;
  
    function cal()
    {
        var d=0;
        for(j=0;j&lt;3;j++)
        {
            for(i=0;i&lt;f1.elements[j].length;i++)
            {
                if(f1.elements[j][i].selected)
                {
                    var y=f1.elements[j].options[i].value;
                    s=new String(y)
                    var a=s.indexOf(&quot;&gt;&quot;);
                    var b=s.substring(a+1,a+3)
                    c=parseInt(b);
                    d=d+c;
                }
            }
        }
        p=&quot;Total Cost Of Selected Items=&quot;+d;
        m=m+&quot;\n&quot;+p;
        f1.elements[3].value=m;
    }
&lt;/textarea&gt;
&lt;br /&gt;
&lt;span id=&quot;para&quot;&gt;
You have to get the value of each selected Item from the menu using the same procedure as above in the pick() function. Once you get the values of the selected Items you can get the position of Greater than(&gt;) symbol before the price using indexOf method, it will get the position of the string. From that you can extract the price using the substring method, it always starts from the given number and ends before the ending number. After that you have converted the String into Integer. Here m is a global variable that stores the value of z.
&lt;/span&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;h3 id=&quot;head&quot;&gt; 
Clear Textbox and Reset Form
&lt;/h3&gt;  
&lt;br/&gt;
&lt;textarea style=&quot;height: 23vh;&quot; wrap=&quot;off&quot;&gt;
  
    function clr()
    {
        f1.elements[3].value=&quot; &quot;;
        f1.reset();
    }
&lt;/textarea&gt;
&lt;br /&gt;
&lt;span id=&quot;para&quot;&gt;
As I mentioned earlier textarea is the 3rd element in the form. Once the clear button is clicked textarea and other form fields will be cleared.
&lt;/span&gt;
&lt;br /&gt;&lt;br /&gt;  
&lt;h3 id=&quot;head&quot;&gt; 
Program
&lt;/h3&gt;  
&lt;br/&gt;  
&lt;textarea style=&quot;height: 160vh;&quot; wrap=&quot;off&quot;&gt;
  
    &lt;!DOCTYPE html&gt;
    &lt;html lang=&quot;en&quot;&gt;
    &lt;head&gt;
    &lt;meta charset=&quot;UTF-8&quot;&gt;
    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
    &lt;title&gt;Document&lt;/title&gt;
    &lt;script language=&quot;javascript&quot;&gt;
    var m;
    function pick()
    {
       var z=&quot; &quot;;
       for(i=0;i&lt;3;i++)
       {
           for(j=0;j&lt;f1.elements[i].length;j++)
           {
               if(f1.elements[i][j].selected)
               {
                   var y=f1.elements[i].options[j].value;
                   z=z+&quot;\n&quot;+y;
                   f1.elements[3].value=z;
               }
           }
       }
       m=z;
    }
    function cal()
    {
        var d=0;
        for(j=0;j&lt;3;j++)
        {
            for(i=0;i&lt;f1.elements[j].length;i++)
            {
                if(f1.elements[j][i].selected)
                {
                    var y=f1.elements[j].options[i].value;
                    s=new String(y)
                    var a=s.indexOf(&quot;&gt;&quot;);
                    var b=s.substring(a+1,a+3)
                    c=parseInt(b);
                    d=d+c;
                }
            }
        }
        p=&quot;Total Cost Of Selected Items=&quot;+d;
        m=m+&quot;\n&quot;+p;
        f1.elements[3].value=m;
    }
    function clr()
    {
        f1.elements[3].value=&quot; &quot;;
        f1.reset();
    }
    &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;h2&gt;&lt;center&gt;Welcome To McDonalds&lt;/center&gt;&lt;/h2&gt;&lt;br/&gt;
    &lt;form name=&quot;f1&quot;&gt;&lt;h3&gt;SELECT MENU ITEMS OF YOUR CHOICE&lt;/h3&gt;&lt;br/&gt;
    &lt;table&gt;&lt;tr&gt;
    &lt;td&gt;MAJOR DISHES&lt;br&gt;
    &lt;select name=&quot;s1&quot; MULTIPLE onclick=&quot;pick()&quot;&gt;
        &lt;option value=&quot;MC BURGER=&gt;80&quot;&gt;MC BURGER&lt;/option&gt;
        &lt;option value=&quot;FISH FILLETS=&gt;70&quot;&gt;FISH FILLETS&lt;/option&gt;
        &lt;option value=&quot;CHICKEN BURGER=&gt;65&quot;&gt;CHICKEN BURGER&lt;/option&gt;
        &lt;option value=&quot;MC CHICKEN=&gt;75&quot;&gt;MC CHICKEN&lt;/option&gt;
        &lt;option value=&quot;GRILLED CHICKEN DELUXE=&gt;90&quot;&gt;GRILLED CHICKEN DELUXE&lt;/option&gt;
        &lt;/select&gt;&lt;/td&gt;      
    
    &lt;td&gt;STARTERS&lt;br&gt;
        &lt;select name=&quot;s2&quot; MULTIPLE onclick=&quot;pick()&quot;&gt;
        &lt;option value=&quot;FRENCH FRIES=&gt;40&quot;&gt;FRENCH FRIES&lt;/option&gt;
        &lt;option value=&quot;NUGGETS=&gt;50&quot;&gt;NUGGETS&lt;/option&gt;
        &lt;option value=&quot;HASH BROWNS=&gt;50&quot;&gt;HASH BROWNS&lt;/option&gt;
        &lt;option value=&quot;SALADS=&gt;30&quot;&gt;SALADS&lt;/option&gt;
        &lt;option value=&quot;LOADED FRIES=&gt;45&quot;&gt;LOADED FRIES&lt;/option&gt; 
        &lt;/select&gt;&lt;/td&gt;

        &lt;td&gt;MISCELLANEOUS&lt;br&gt;
            &lt;select name=&quot;s3&quot; onclick=&quot;pick()&quot;&gt;
            &lt;option value=&quot; &quot;&gt;Select&lt;/option&gt;
            &lt;option value=&quot;MILK SHAKES=&gt;35&quot;&gt;MILK SHAKES&lt;/option&gt;
            &lt;option value=&quot;SOFT DRINKS=&gt;40&quot;&gt;SOFT DRINKS&lt;/option&gt;
            &lt;option value=&quot;COFFEE AND TEA=&gt;30&quot;&gt;COFFEE AND TEA&lt;/option&gt;
            &lt;option value=&quot;ALCOHOLIC BEVARAGES=&gt;50&quot;&gt;ALCOHOLIC BEVARAGES&lt;/option&gt;
            &lt;/select&gt;&lt;/td&gt;    

    &lt;/tr&gt;
    &lt;/table&gt;&lt;br/&gt;&lt;br/&gt;
    The Items Selected From Menu Are &lt;br/&gt;
    &lt;textarea name=&quot;ta&quot; rows=&quot;10&quot; cols=&quot;50&quot;/&gt;&lt;br/&gt;
    &lt;input name=&quot;b1&quot; type=&quot;button&quot; value=&quot;TOTAL COST&quot; onclick=&quot;cal()&quot;/&gt;
    &lt;input name=&quot;b2&quot; type=&quot;button&quot; value=&quot;CLEAR&quot; onclick=&quot;clr()&quot;/&gt;
    &lt;/form&gt;
    &lt;/body&gt;
    &lt;/html&gt;
&lt;/textarea&gt;
 &lt;br/&gt;&lt;br/&gt;
  &lt;a href=&quot;https://www.knowsabouts.in/2020/07/mark-sheet-result-page-using-html-and.html&quot;&gt;Here is the link for Mark Sheet Result Page using Html and Css.&lt;/a&gt;
  &lt;br&gt;  
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/6589886240415684169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/07/billing-software-for-shops-using-html.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6589886240415684169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6589886240415684169'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/07/billing-software-for-shops-using-html.html' title='Billing Software for Shops using Html and Java Script | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfeMkAkx03Bq38lao-KHk1WLenaZBSISg7QUGkwHKj51OgAfbiQXkfw3Af673ChiHcGg2PTaK_w3jVq5y50mEwDs7CBRM2wZWYQXjb3HW3pJUcyWOg_gZ9zl9FCDQm1Muw1gaHF5-6NsD_/s72-c/Screenshot+%2528146%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-4141033288966864937</id><published>2021-07-14T19:10:00.006+05:30</published><updated>2021-09-29T23:33:20.677+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Google Kick Start Round A 2021 L shaped plots problem solved using Python"/><title type='text'>Round A 2021 Google Kick Start L Shaped Plots Problem| PYTHON | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
align-items: center;
font-size: medium;      
font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 165vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;

&lt;span id=&quot;para&quot;&gt;

&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Given a grid of R rows and C columns each cell in the grid is either 0 or 1.
&lt;br/&gt;&lt;br/&gt;
A segment is a nonempty sequence of consecutive cells such that all cells are in the same row or the same column. We define the length of a segment as number of cells in the sequence.
&lt;br/&gt;&lt;br/&gt;
A segment is called &quot;good&quot; if all the cells in the segment contain only 1s.  
&lt;br/&gt;&lt;br/&gt;
An &quot;L-shape&quot; is defined as an unordered pair of segments, which has all the following properties:  
&lt;br/&gt;&lt;br/&gt;  
Each of the segments must be a &quot;good&quot; segment.&lt;br&gt;  
The two segments must be perpendicular to each other.&lt;br&gt;
The segments must share one cell that is an endpoint of both segments.&lt;br&gt;
Segments must have length at least 2.&lt;br&gt;
The length of the longer segment is twice the length of the shorter segment. 
&lt;br/&gt;&lt;br/&gt;  
We need to count the number of L-shapes in the grid.  
&lt;br/&gt;&lt;br/&gt;  
Below you can find two examples of correct L-shapes,  
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP4YvC0YZv1LuqLxrbUY11aZWNoJ9ZOLOElCdFTVzyzYmKU-HmTQWgwGKnZLv5_Ts8PWTQFEDYyeCsF5r7FSRhUhjD6GdiMk38RvYeeFmvLJO8YR4wRpJGSn7QTiruEAifKT-YtshklgZX/s608/Screenshot+%2528100%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; clear: left; float: left;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;298&quot; data-original-width=&quot;608&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP4YvC0YZv1LuqLxrbUY11aZWNoJ9ZOLOElCdFTVzyzYmKU-HmTQWgwGKnZLv5_Ts8PWTQFEDYyeCsF5r7FSRhUhjD6GdiMk38RvYeeFmvLJO8YR4wRpJGSn7QTiruEAifKT-YtshklgZX/s400/Screenshot+%2528100%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
and three examples of invalid L-shapes.
&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCMCYxppOenQEY4ICKlotHICzgPU8ptmrxPDrAtidbKmvUMMJ4JEF2g8Mvsq1X1pUN_sGta1xRqWWdD4zdsQbYoUFnnejdyAQSSfE3QezIdELmT5ishZ7m-_zsSn7yjTX2r7nRtl62zFYt/s645/Screenshot+%2528101%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; clear: left; float: left;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;348&quot; data-original-width=&quot;645&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCMCYxppOenQEY4ICKlotHICzgPU8ptmrxPDrAtidbKmvUMMJ4JEF2g8Mvsq1X1pUN_sGta1xRqWWdD4zdsQbYoUFnnejdyAQSSfE3QezIdELmT5ishZ7m-_zsSn7yjTX2r7nRtl62zFYt/s400/Screenshot+%2528101%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
Note that in the shape on the left, two segments do not share a common endpoint. The next two shapes do not meet the last requirement, as in the middle shape both segments have the same length, and in the last shape the longer segment is longer than twice the length of the shorter one.  
&lt;br/&gt;&lt;br/&gt;  
  
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input contains the number of test cases, T. T test cases follow.
&lt;br/&gt;&lt;br/&gt;  
The first line of each testcase contains two integers R and C.
&lt;br/&gt;&lt;br/&gt;  
Then, R lines follow, each line with C integers representing the cells of the grid.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the number of L-shapes.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZWDtKvuBXW_fth48Bw30SAZWlqJkHWq11C9Qh_slkHI8gsnIMzhTK49H4VASygI5KIvsjcpXYtXWsCXBV1poEj3GsgfYs9uZOxtnM49Hhzy-V18Uzb5ueJyV7PLMHkn40IHtfb__KG6J2/s358/Screenshot+%2528102%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;303&quot; data-original-width=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZWDtKvuBXW_fth48Bw30SAZWlqJkHWq11C9Qh_slkHI8gsnIMzhTK49H4VASygI5KIvsjcpXYtXWsCXBV1poEj3GsgfYs9uZOxtnM49Hhzy-V18Uzb5ueJyV7PLMHkn40IHtfb__KG6J2/s400/Screenshot+%2528102%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
  
In Sample Case #1, there is one L-shape.&lt;br/&gt;
The first one is formed by using cells: (1,1), (2,1), (3,1), (4,1), (4,2)&lt;br/&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvt2iyCkskWlNgIJScenDHyW2g3RY6sgc_5L9f_eYFWUlQ8chmcPr3JA6LtW9UDbRNR0i8fzhcA0i0vSypdjiYqJ9nGvcTMXpiL1nm1_aXBChHIii-nn7kWs4gtoZMzhQ83UA-245go1n6/s287/Screenshot+%2528103%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; clear: left; float: left;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;400&quot; data-original-height=&quot;287&quot; data-original-width=&quot;273&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvt2iyCkskWlNgIJScenDHyW2g3RY6sgc_5L9f_eYFWUlQ8chmcPr3JA6LtW9UDbRNR0i8fzhcA0i0vSypdjiYqJ9nGvcTMXpiL1nm1_aXBChHIii-nn7kWs4gtoZMzhQ83UA-245go1n6/s400/Screenshot+%2528103%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
In Sample Case #2, there are nine L-shapes.
&lt;br/&gt;&lt;br/&gt;
The first one is formed by using cells: (1,1), (2,1), (3,1), (4,1), (5,1), (6,1), (6,2), (6,3)
The second one is formed by using cells: (3,1), (4,1), (5,1), (6,1), (6,2)&lt;br/&gt;
The third one is formed by using cells: (6,1), (5,1), (4,1), (3,1), (3,2)&lt;br/&gt;
The fourth one is formed by using cells: (3,3), (4,3), (5,3), (6,3), (6,2)&lt;br/&gt;
The fifth one is formed by using cells: (6,3), (5,3), (4,3), (3,3), (3,2)&lt;br/&gt;
The sixth one is formed by using cells: (3,1), (3,2), (3,3), (3,4), (2,4)&lt;br/&gt;
The seventh one is formed by using cells: (3,4), (3,3), (3,2), (3,1), (2,1)&lt;br/&gt;
The eighth one is formed by using cells: (3,4), (3,3), (3,2), (3,1), (4,1)&lt;br/&gt;
The ninth one is formed by using cells: (6,3), (5,3), (4,3), (3,3), (3,4)&lt;br/&gt;
The first three L-shapes are shown on the picture below.
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigjI4bEIY2_oC2mj3zjBCUwNsUxQs_j3vlCKvMFmPLOBm3ypx1P7HC6riCQ9o7cyqw7q7HF_LQtpB-NGHngtTEAcOqe9IbF226qlv7hUQVgxQER3w8txTvPSfFyUAN254NfHOw4L48SsMh/s870/Screenshot+%2528104%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; clear: left; float: left;&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;410&quot; data-original-width=&quot;870&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigjI4bEIY2_oC2mj3zjBCUwNsUxQs_j3vlCKvMFmPLOBm3ypx1P7HC6riCQ9o7cyqw7q7HF_LQtpB-NGHngtTEAcOqe9IbF226qlv7hUQVgxQER3w8txTvPSfFyUAN254NfHOw4L48SsMh/s400/Screenshot+%2528104%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;  
&lt;/span&gt;

&lt;br/&gt;&lt;br/&gt;

&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
  
&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;textarea  wrap=&quot;off&quot;&gt;
     def number_of_l_shapes(len_1, len_2):
         if len_1 &lt;= 1 or len_2 &lt;= 1:
             return 0

         return min(len_1 // 2, len_2) + min(len_1, len_2 // 2) - 2

     T = int(input())

     for t in range(T):
         R, C = map(int, input().split())
         G = [list(map(int, input().split())) for _ in range(R)]

         left = []
         for i in range(R):
             row = [G[i][0]]
             for j in range(1, C):
                 row += [0 if G[i][j] == 0 else row[j-1] + 1]
             left.append(row)

         right = []
         for i in range(R):
             revered_row = list(reversed(G[i]))
             row = [revered_row[0]]
             for j in range(1, C):
                 row += [0 if revered_row[j] == 0 else row[j-1] + 1]
             right.append(list(reversed(row)))

         top = [[G[0][j] for j in range(C)]]
         for i in range(1, R):
             row = [
                 0 if G[i][j] == 0 else top[i - 1][j] + 1
                 for j in range(C)
             ]
             top.append(row)

         bottom = [[G[R-1][j] for j in range(C)]]
         for i in range(1, R):
             row = [
                 0 if G[R - i - 1][j] == 0 else bottom[i - 1][j] + 1
                 for j in range(C)
             ]
             bottom.append(row)
         bottom.reverse()

         ans = 0
         for i in range(R):
             for j in range(C):
                 ans += number_of_l_shapes(top[i][j], right[i][j]) \
                        + number_of_l_shapes(top[i][j], left[i][j]) \
                        + number_of_l_shapes(bottom[i][j], right[i][j]) \
                        + number_of_l_shapes(bottom[i][j], left[i][j])

         print(f&#39;Case #{t+1}:&#39;, ans)
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;
  &lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using JAVA.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/4141033288966864937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/07/round-2021-google-kick-start-l-shaped.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4141033288966864937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4141033288966864937'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/07/round-2021-google-kick-start-l-shaped.html' title='Round A 2021 Google Kick Start L Shaped Plots Problem| PYTHON | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP4YvC0YZv1LuqLxrbUY11aZWNoJ9ZOLOElCdFTVzyzYmKU-HmTQWgwGKnZLv5_Ts8PWTQFEDYyeCsF5r7FSRhUhjD6GdiMk38RvYeeFmvLJO8YR4wRpJGSn7QTiruEAifKT-YtshklgZX/s72-c/Screenshot+%2528100%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-6261670238199089653</id><published>2021-07-01T19:37:00.003+05:30</published><updated>2022-02-21T22:53:27.687+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Running python code in cloud platform called Google Colaboratory."/><title type='text'>ModuleNotFoundError: No module named &#39;matplotlib&#39;. How to run cross platform matplotlib in Google Colaboratory ?</title><content type='html'>&lt;html&gt;
  &lt;head&gt;
    &lt;style type=&quot;text/css&quot;&gt;
    #b{
       color:black; 
       align-items: center;
      font-size: medium;
        font-family:sans-serif;
      }
      p {
        align-items: center;
        color: blue;
        font-family:sans-serif;
        font-size: medium;
      }
      textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 100vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
      &lt;/style&gt;
    &lt;/head&gt;
  
  &lt;body&gt;
    &lt;h2 style=&quot;color:red; font-weight:bold;&quot;&gt;RUNNING PYTHON LIBRARY MATPLOTLIB IN GOOGLE COLABORATORY&lt;/h2&gt;
    &lt;p&gt;
      If you are searching for how to run python&#39;s library function matplotlib in Google Colaboratory or any other python program in Colaboratory you are in the right place all you have to do is continue reading.
      &lt;/p&gt;
&lt;br&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;INSTALLATION PROCESS&lt;/h3&gt;
    &lt;span id=&quot;b&quot;&gt;
      If you want to run matplotlib in your Integration Development Learning Environment(IDLE) for that you have to install Graphic User Interface(GUI). Instead of installing a python IDE you can also use Colaboratory as your python Development platform and all the programs you have done will be stored in the cloud.
      &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;span id=&quot;b&quot;&gt;
    Sign into Google Drive with your Account. Right Click and select connect more apps here you can see a lot of apps can be directly used in Google Drive, scroll down and search for Google Colaboratory and then install it if not installed.
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
     &lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVkB2cBj3MqJmhIeTpOXPHFddCU13VyP4qkDkkWQcMv5sQToNafkhBQSmT7XJUCgzGd2SjC5_Ndad8eHUWXxcX79N1UqqkatmGrrOLqIkaBMoXqj0KnRzUhCRCYs1W_j-i0T37InQmjRU5/s635/Screenshot+%252880%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;494&quot; data-original-width=&quot;635&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVkB2cBj3MqJmhIeTpOXPHFddCU13VyP4qkDkkWQcMv5sQToNafkhBQSmT7XJUCgzGd2SjC5_Ndad8eHUWXxcX79N1UqqkatmGrrOLqIkaBMoXqj0KnRzUhCRCYs1W_j-i0T37InQmjRU5/s400/Screenshot+%252880%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;CHANGING RUNTIME TYPE TO GPU&lt;/h3&gt;
    &lt;span id=&quot;b&quot;&gt;
    Graphic Processing Unit(GPU) which is free to use in Google Colaboratory. Click Runtime from the menu and select Change runtime type here you can see Hardware Accelerator and change it to GPU. If there is no need to use Processing Units turn it to none before coding it will help you to get better performance.
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwSL6xZL0VSiEalwUjzFOGREvIgKQhXtAmvGhHl8G0rPgoeEnZJ8V5jhF1MVOCe4Ms33RTDzdmKCFjqRniyQZodCX7LfM5fNwqtmDtF8LhC34RtyLDtiz6RzqOY0XshshzwdENYKkAkUFk/s333/Screenshot+%252881%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;236&quot; data-original-width=&quot;333&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwSL6xZL0VSiEalwUjzFOGREvIgKQhXtAmvGhHl8G0rPgoeEnZJ8V5jhF1MVOCe4Ms33RTDzdmKCFjqRniyQZodCX7LfM5fNwqtmDtF8LhC34RtyLDtiz6RzqOY0XshshzwdENYKkAkUFk/s400/Screenshot+%252881%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;PYTHON CODE USING MATPLOTLIB&lt;/h3&gt;
    &lt;span id=&quot;b&quot;&gt;
    Now we are going to create a simple 2D graph for the visitors of some place with Days. Firstly we have to import the matplotlib package also with the plotting function pyplot. After typing the code just click on the play button to run the code. If you want to run another code click the +code to get the coding line.
    &lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Here&#39;s the python code to show the 2D Graph&lt;/h3&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:40vh&quot;&gt;
      import matplotlib.pyplot as plt
      
      lab =[&quot;MON&quot;,&quot;TUE&quot;,&quot;WED&quot;,&quot;THUR&quot;,&quot;FRI&quot;,&quot;SAT&quot;]
      usage = [3,2,1,3,2,2]
      pos = range(len(lab))
      
      plt.bar(pos, usage)
      plt.xticks(pos,lab)
      plt.xlabel(&quot;Days&quot;)
      plt.ylabel(&quot;In Lakhs&quot;)
      plt.title(&quot;NUMBER OF PEOPLE VISITED&quot;)
      plt.show()  
      &lt;/textarea&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDeCsjUhRfUo8cpWD5jh1aeFthCJLugtyfXY12etQKW34I5AJv2xA4fNGEjWP1taKaW8BY0vCKcjl0q3swWeIzy3mq2cppzhyphenhyphenYhPCC_7qekndhegt8tgW_kTojejbW5HWIB5YYLaYLKP8K/s356/Screenshot+%252879%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;248&quot; data-original-width=&quot;356&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDeCsjUhRfUo8cpWD5jh1aeFthCJLugtyfXY12etQKW34I5AJv2xA4fNGEjWP1taKaW8BY0vCKcjl0q3swWeIzy3mq2cppzhyphenhyphenYhPCC_7qekndhegt8tgW_kTojejbW5HWIB5YYLaYLKP8K/s400/Screenshot+%252879%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
    
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Read and Write Images using matplotlib&lt;/h3&gt;
    
    &lt;span id=&quot;b&quot;&gt;To read images in python you can import a CV library like cv2.imread(&quot;here you have to give the image address from files on the left side bar&quot;). If you don&#39;t have any image then upload it from your computer and then you have to import matplotlib and pyplot function to write the image.&lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Python Code to List All Project From Drive&lt;/h3&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:25vh&quot;&gt;
    import cv2
      
    img = cv2.imread(&quot;/Screenshot (53).png&quot;, cv2.IMREAD_COLOR)  
      
    import matplotlib
    from matplotlib import pyplot
    pyplot.imshow(img)   
&lt;/textarea&gt;    
      &lt;br&gt;&lt;br&gt;
    &lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfZPJY5JhKcVpc3xFLlwLaFcrIO7tbZpe6Lglz43_1LRaq0bugJXj8BWJOM7QCdYSZXkeAqrYmLWT8K-PiktdreDwNla4O5owL04jkEgHasPNyyeKNB-_TUMMdjokBexTiuZFGSQQz6Ek6/s341/Screenshot+%252883%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;214&quot; data-original-width=&quot;341&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfZPJY5JhKcVpc3xFLlwLaFcrIO7tbZpe6Lglz43_1LRaq0bugJXj8BWJOM7QCdYSZXkeAqrYmLWT8K-PiktdreDwNla4O5owL04jkEgHasPNyyeKNB-_TUMMdjokBexTiuZFGSQQz6Ek6/s400/Screenshot+%252883%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
    
    &lt;span id=&quot;b&quot;&gt;And you can convert the Image into Negative Image by Bitwise Not function.&lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Python Code to List All Project From Drive&lt;/h3&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:15vh&quot;&gt;
    img_not = cv2.bitwise_not(img)
      
    pyplot.imshow(img_not)
&lt;/textarea&gt;    
      &lt;br&gt;&lt;br&gt;
    &lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2moUibjfOpazgVPxxROUDFNsjNS3H5sIiQ3Vvl1B28Z-Nb896nKh5jBj27nAxaB2WH4pvOF_AcB76NI7qpYN_SxtkPtgLzmu5GPOX44KTIqDK1Gmp2knEwJnkji6Fg98PMo-uOTvNG7FX/s331/Screenshot+%252884%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;211&quot; data-original-width=&quot;331&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2moUibjfOpazgVPxxROUDFNsjNS3H5sIiQ3Vvl1B28Z-Nb896nKh5jBj27nAxaB2WH4pvOF_AcB76NI7qpYN_SxtkPtgLzmu5GPOX44KTIqDK1Gmp2knEwJnkji6Fg98PMo-uOTvNG7FX/s400/Screenshot+%252884%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
    
      
       
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;LISTING PROJECTS FROM DRIVE&lt;/h3&gt;
    
    &lt;span id=&quot;b&quot;&gt;Firstly you have to import google drive in google colaboratory and then you have to import tensorflow library for the computation process it was released by Google itself. Using mount you can read the data from your drive while running it verifies by you to logging into your account and also you have to copy and paste a code in the verification process and then click code to text line using list content in the current directory you can display all the projects from Google Drive or Google Cloud.&lt;/span&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;h3 style=&quot;color:red; font-size:large; font-weight:bold;&quot;&gt;Python Code to List All Project From Drive&lt;/h3&gt;
    &lt;textarea wrap=&quot;off&quot; style=&quot;height:37vh&quot;&gt;
    from google.colab import drive
      
    import tensorflow as tf
    tf.test.gpu_device_name() 
    //device:GPU:0    
      
    drive.mount(&#39;/drive/&#39;)
    //Mounted at /drive/  
      
    !ls &quot;/drive/My Drive&quot;  
&lt;/textarea&gt;    
      &lt;br&gt;&lt;br&gt;
    &lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-wGwj9pDtx9YfAEBFkovjZNXL2X6wI03CMjX7qbp8w4IZVEzZCwSTr-9tBVrjSbRDujlrTS3YiXswaGHtcPpY9cMgAqUoYWFLKxFFEDz7KxCVwiSkQc2EFtTj9Q7EEOPjYBzAoG8t4myU/s598/Screenshot+%252882%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;320&quot; data-original-width=&quot;598&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-wGwj9pDtx9YfAEBFkovjZNXL2X6wI03CMjX7qbp8w4IZVEzZCwSTr-9tBVrjSbRDujlrTS3YiXswaGHtcPpY9cMgAqUoYWFLKxFFEDz7KxCVwiSkQc2EFtTj9Q7EEOPjYBzAoG8t4myU/s400/Screenshot+%252882%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
    
&lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using Java.&lt;/a&gt;
  &lt;br&gt;&lt;br&gt;

      
&lt;/body&gt;
  &lt;/html&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/6261670238199089653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/07/modulenotfounderror-no-module-named.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6261670238199089653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6261670238199089653'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/07/modulenotfounderror-no-module-named.html' title='ModuleNotFoundError: No module named &#39;matplotlib&#39;. How to run cross platform matplotlib in Google Colaboratory ?'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVkB2cBj3MqJmhIeTpOXPHFddCU13VyP4qkDkkWQcMv5sQToNafkhBQSmT7XJUCgzGd2SjC5_Ndad8eHUWXxcX79N1UqqkatmGrrOLqIkaBMoXqj0KnRzUhCRCYs1W_j-i0T37InQmjRU5/s72-c/Screenshot+%252880%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-5746919032275005048</id><published>2021-04-14T22:19:00.004+05:30</published><updated>2021-09-29T23:32:21.078+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Round f 2020 google kickstart ATM queue prblem"/><title type='text'>Round F 2020 Google Kick Start ATM Queue Problem | Java | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
       align-items: center;
      font-size: medium;
        font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 95vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;

&lt;span id=&quot;para&quot;&gt;

&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
There are N people numbered from 1 to N, standing in a queue to withdraw money from an ATM. The queue is formed in ascending order of their number. The person numbered i wants to withdraw amount Ai. The maximum amount a person can withdraw at a time is X. If they need more money than X, they need to go stand at the end of the queue and wait for their turn in line. A person leaves the queue once they have withdrawn the required amount.
&lt;br&gt;&lt;br&gt;  
You need to find the order in which all the people leave the queue.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases T. T test cases follow. 
&lt;br/&gt;&lt;br/&gt;  
The first line of each test case gives two space separated integers: the number of people standing in the queue, N and the maximum amount X that can be withdrawn in one turn.
&lt;br/&gt;&lt;br/&gt;
The next line contains N space separated integers Ai.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the space separated list of integers that denote the order in which the people leave the queue.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimZoPp5_kwAqvShoha_xexi27W7c6SLW9hxahHQxOih95oAe29XH4upuzAGO5PyDf5UVahoi5zv-L_0b0VaNFyTAWO2X5V2Mvwyq8Rede1fzv9iqjIulQEvxbCP0v7-NNFTJvS6GsPHMPA/s358/Screenshot+%2528891%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;235&quot; data-original-width=&quot;358&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimZoPp5_kwAqvShoha_xexi27W7c6SLW9hxahHQxOih95oAe29XH4upuzAGO5PyDf5UVahoi5zv-L_0b0VaNFyTAWO2X5V2Mvwyq8Rede1fzv9iqjIulQEvxbCP0v7-NNFTJvS6GsPHMPA/s400/Screenshot+%2528891%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
  
In Sample Case #1, there are 3 people and the limit to withdraw in one turn is 3. Below is step-by-step description of how the process will look like:
&lt;br/&gt;&lt;br&gt;
The queue initially looks like [1, 2, 3]. The first person withdraws an amount of 2 in their first attempt and leaves the queue.&lt;br/&gt;
The queue now looks like [2, 3]. The second person wants to withdraw an amount of 7, but they can withdraw only 3 in their first turn. Since they still need to withdraw an amount of 4, they have to rejoin the queue at the end of the line.&lt;br/&gt;
The queue now looks like [3, 2]. The third person needs to withdraw an amount of 4 but they can only withdraw 3 in their first turn so, they rejoin the queue at the end of the line to withdraw amount of 1 later.&lt;br/&gt;
The queue now looks like [2, 3]. The second person still needs to withdraw an amount of 4. They withdraw an amount of 3 in their second turn and waits for their next turn to arrive to withdraw the remaining amount of 1.&lt;br/&gt;
The queue now looks like [3, 2]. The third person withdraws the remaining amount of 1 and leaves the queue.&lt;br/&gt;
The queue now looks like [2]. The second person withdraws the remaining amount of 1 and leaves the queue.&lt;br/&gt;
The queue is now empty.&lt;br/&gt;
The order in which people leave the queue is [1, 3, 2].
&lt;br/&gt;&lt;br&gt;
In Sample Case #2, there are 5 people and the limit to withdraw in one turn is 6. Below is step-by-step description of how the process will look like:
&lt;br/&gt;&lt;br&gt;
The queue initially looks like [1, 2, 3, 4, 5]. The first person withdraws an amount of 6, and joins at the end again to withdraw the remaining amount of 3 later.&lt;br&gt;
The queue looks like [2, 3, 4, 5, 1]. The second person similarly withdraws an amount of 6 and waits for his next turn to withdraw an amount of 4.&lt;br&gt;
The queue looks like [3, 4, 5, 1, 2]. The third person withdraws an amount of 4 and leaves the queue.&lt;br&gt;
The queue now looks like [4, 5, 1, 2]. The fourth person withdraws 6 and waits for his next turn.&lt;br&gt;
The queue looks like [5, 1, 2, 4]. The fifth person withdraws amount of 2 and leaves the queue.&lt;br&gt;
The queue looks like, [1, 2, 4]. All other people now leave the queue after their second turn one by one.&lt;br&gt;
The order in which people leave the queue is [3, 5, 1, 2, 4].&lt;br/&gt;
&lt;/span&gt;
&lt;br/&gt;&lt;br/&gt;
  
&lt;span id=&quot;head&quot;&gt;Test Set 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;
&lt;textarea  wrap=&quot;off&quot;&gt;
    import java.util.*;
    public class Solution {

    static class c {
        int qno;
        int amt;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 1; i &lt;= t; i++) {
            ArrayList&lt;c&gt; queue = new ArrayList&lt;&gt;();
            ArrayList&lt;Integer&gt; order = new ArrayList&lt;&gt;();

            int nop = sc.nextInt();
            int maxamt = sc.nextInt();

            int[] a = new int[nop];
            for (int j = 0; j &lt; nop; j++) {
                a[j] = sc.nextInt();
            }

            for (int k = 0; k &lt; nop; k++) { 
                c c = new c();
                c.qno = k + 1;
                c.amt = a[k];
                queue.add(c);
            }

            while (queue.size() &gt; 0) {
                c c = queue.remove(0);
                c.amt -= maxamt;
                if (c.amt &gt; 0) {
                    queue.add(c);
                } else {
                    order.add(c.qno);
                }
            }

            System.out.print(&quot;\nCase #&quot; + i + &quot;: &quot;);
            for (Integer integer : order) {
                System.out.print(integer + &quot; &quot;);
            }
       }
      }
     }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;  
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;  

&lt;span id=&quot;head&quot;&gt;Test Set 2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;
&lt;textarea  wrap=&quot;off&quot;&gt;
    import java.util.*;
    import java.io.*;
    import java.util.stream.*;

    public class Solution {

    private static final Scanner _in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

    private static String solve() {
        final int N = _in.nextInt();
        final int X = _in.nextInt();

        int[] A = IntStream.range(0, N)
            .map(i -&gt; (int)Math.ceil(_in.nextInt()/(double)X)).toArray();

        return String.join(&quot; &quot;,
            IntStream.range(0, N)
                .boxed()
                .sorted((i, j) -&gt; A[i] - A[j])
                .map(i -&gt; Integer.toString(i+1))
                .collect(Collectors.toList()));
    }

    public static void main(String[] args) {
        final int T = _in.nextInt();
        for (int i = 1; i &lt;= T; ++i) {
            System.out.println(&quot;Case #&quot; + i + &quot;: &quot; + solve());
        }
      }
    }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;
  &lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using JAVA.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/5746919032275005048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/04/round-f-2020-google-kick-start-atm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/5746919032275005048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/5746919032275005048'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/04/round-f-2020-google-kick-start-atm.html' title='Round F 2020 Google Kick Start ATM Queue Problem | Java | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimZoPp5_kwAqvShoha_xexi27W7c6SLW9hxahHQxOih95oAe29XH4upuzAGO5PyDf5UVahoi5zv-L_0b0VaNFyTAWO2X5V2Mvwyq8Rede1fzv9iqjIulQEvxbCP0v7-NNFTJvS6GsPHMPA/s72-c/Screenshot+%2528891%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-8581704136876873202</id><published>2021-04-06T19:28:00.005+05:30</published><updated>2021-09-29T23:31:51.652+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Google kick start Round E 2020 Longest Arithmetic problem solved using java"/><title type='text'>Round E 2020 Google Kick Start Longest Arithmetic Problem | Java | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
       align-items: center;
      font-size: medium;
        font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 95vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;

&lt;span id=&quot;para&quot;&gt;

&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
An arithmetic array is an array that contains at least two integers and the differences between consecutive integers are equal. For example, [9, 10], [3, 3, 3], and [9, 7, 5, 3] are arithmetic arrays, while [1, 3, 3, 7], [2, 1, 2], and [1, 2, 4] are not arithmetic arrays.
&lt;br&gt;&lt;br&gt;  
Sarasvati has an array of N non-negative integers. The i-th integer of the array is Ai. She wants to choose a contiguous arithmetic subarray from her array that has the maximum length. Please help her to determine the length of the longest contiguous arithmetic subarray.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow. Each test case begins with a line containing the integer N. The second line contains N integers. The i-th integer is Ai.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the length of the longest contiguous arithmetic subarray.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAshHm_aBNSi6WZ_ymtbJtEagEt7BF-oLMcgfCThxrnRKaKmF1MQIbhp1fOKhoc55ZGO0PD9DOfx6Aya0LqXRvo4jRytQCxTenmRAEs9pSPxK4tn_kbCUVguIm94c0FIv5sq_FJ5jHn9A2/s541/Screenshot+%2528839%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;336&quot; data-original-width=&quot;541&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAshHm_aBNSi6WZ_ymtbJtEagEt7BF-oLMcgfCThxrnRKaKmF1MQIbhp1fOKhoc55ZGO0PD9DOfx6Aya0LqXRvo4jRytQCxTenmRAEs9pSPxK4tn_kbCUVguIm94c0FIv5sq_FJ5jHn9A2/s400/Screenshot+%2528839%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
  
In Sample Case #1, the integers inside the bracket in the following represent the longest contiguous arithmetic subarray: 10 7 [4 6 8 10] 11
&lt;br/&gt;&lt;br&gt;
In Sample Case #2, the whole array is an arithmetic array, thus the longest contiguous arithmetic subarray is the whole array.
&lt;br/&gt;&lt;br&gt;
In Sample Case #3, the longest contiguous arithmetic subarray is either [5, 5, 5] (a subarray from the fourth integer to the sixth integer) or [4, 5, 6] (a subarray from the seventh integer to the ninth integer)
&lt;br/&gt;&lt;br&gt;
In Sample Case #4, the longest contiguous arithmetic subarray is the last six integers.&lt;br/&gt;
&lt;/span&gt;

&lt;br/&gt;&lt;br/&gt;
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
  

&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;
&lt;textarea  wrap=&quot;off&quot;&gt;
    import java.util.*;
    public class Solution{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		for(int s=1; s&lt;=t; s++) {
			int n = sc.nextInt();
			int[] a = new int[n];
			for(int i=0; i&lt;n; i++) {
				a[i] = sc.nextInt();
			}
			int LA = longestArithmetic(a);
			System.out.printf(&quot;Case #%d: %d\n&quot;,s,LA);
		}
	}

	private static int longestArithmetic(int[] a) {
		int ct,st=0,dif;
		for(int i=0; i&lt;a.length-1;) {
			int j= i;
			dif = a[i+1] - a[i];
			while((j&lt;a.length-1) &amp;&amp; (a[j+1] - a[j] == dif))
				j++;
				ct = j;
				st = Math.max(st, ct - i +1);
				i=Math.max(i+1, j);		
		}
		return st;
	 }
    }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;
  &lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using JAVA.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/8581704136876873202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/04/round-e-2020-google-kick-start-longest.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/8581704136876873202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/8581704136876873202'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/04/round-e-2020-google-kick-start-longest.html' title='Round E 2020 Google Kick Start Longest Arithmetic Problem | Java | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAshHm_aBNSi6WZ_ymtbJtEagEt7BF-oLMcgfCThxrnRKaKmF1MQIbhp1fOKhoc55ZGO0PD9DOfx6Aya0LqXRvo4jRytQCxTenmRAEs9pSPxK4tn_kbCUVguIm94c0FIv5sq_FJ5jHn9A2/s72-c/Screenshot+%2528839%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-6602477319840507024</id><published>2021-04-06T16:18:00.005+05:30</published><updated>2021-09-29T23:31:33.150+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Round D 2020  google kickstart record breaker task problem solved using java"/><title type='text'>Round D 2020 Google Kick Start Record Breaker Problem | Java | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
       align-items: center;
      font-size: medium;
        font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 87vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;

&lt;span id=&quot;para&quot;&gt;

&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
Isyana is given the number of visitors at her local theme park on N consecutive days. The number of visitors on the i-th day is Vi. A day is  
record breaking if it satisfies both of the following conditions: 
&lt;br&gt;&lt;br&gt;  
The number of visitors on the day is strictly larger than the number of visitors on each of the previous days.&lt;br&gt;
Either it is the last day, or the number of visitors on the day is strictly larger than the number of visitors on the following day.
&lt;br&gt;  
Note that the very first day could be a record breaking day!
&lt;br/&gt;&lt;br/&gt;
Please help Isyana find out the number of record breaking days.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow. Each test case begins with a line containing the integer N. The second line contains N integers. The i-th integer is Vi.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the number of record breaking days.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ-N2YFrsWpQ1u5uf1k51wiVK5wbgQh_X68uIruG_PV50XLZwTtPRMEcJJFK8Kqjt4RhsVllDl907-54ewFpYj2ETwnqq1mLL3vOw3PncrzjF4LUu4-fkSz_5jl-mMHtPUYQATOh7ATx5a/s530/Screenshot+%2528838%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;339&quot; data-original-width=&quot;530&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ-N2YFrsWpQ1u5uf1k51wiVK5wbgQh_X68uIruG_PV50XLZwTtPRMEcJJFK8Kqjt4RhsVllDl907-54ewFpYj2ETwnqq1mLL3vOw3PncrzjF4LUu4-fkSz_5jl-mMHtPUYQATOh7ATx5a/s400/Screenshot+%2528838%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
  
In Sample Case #1, the bold and underlined numbers in the following represent the record breaking days: 1 2 0 7 2 0 2 0.
&lt;br/&gt;&lt;br&gt;
In Sample Case #2, only the last day is a record breaking day.
&lt;br/&gt;&lt;br&gt;
In Sample Case #3, the first, the third, and the sixth days are record breaking days.
&lt;br/&gt;&lt;br&gt;
In Sample Case #4, there is no record breaking day.&lt;br/&gt;
&lt;/span&gt;

&lt;br/&gt;&lt;br/&gt;
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;span id=&quot;para&quot;&gt;
If the Record Greater than the Previous Record and Greater than Following Record you can count it as a record breaking day.
&lt;/span&gt;

&lt;br /&gt;&lt;br /&gt;
&lt;textarea  wrap=&quot;off&quot;&gt;
    import java.io.*;
    import java.util.*;

    public class Solution{
    public static void main(String[] args){
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t=sc.nextInt();
        for(int i=1;i&lt;=t;i++){
            int N,p=0,count=0;
            N = sc.nextInt();
            int[] n = new int[N];
            for(int j=0;j&lt;N;j++){
                n[j]=sc.nextInt();
            }
            for(int l=0; l&lt;N; l++){
                boolean gpd = l ==0 || n[l] &gt; p;
                boolean gfd = l == N-1 || n[l] &gt; n[l+1];
                if(gpd &amp;&amp; gfd) count++;
                p = Math.max(p,n[l]);
            }
            System.out.printf(&quot;Case #%d: %d\n&quot;,i,count);
          }
       }
     }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;
  &lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using JAVA.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/6602477319840507024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/04/round-d-2020-google-kick-start-record.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6602477319840507024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/6602477319840507024'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/04/round-d-2020-google-kick-start-record.html' title='Round D 2020 Google Kick Start Record Breaker Problem | Java | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZ-N2YFrsWpQ1u5uf1k51wiVK5wbgQh_X68uIruG_PV50XLZwTtPRMEcJJFK8Kqjt4RhsVllDl907-54ewFpYj2ETwnqq1mLL3vOw3PncrzjF4LUu4-fkSz_5jl-mMHtPUYQATOh7ATx5a/s72-c/Screenshot+%2528838%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4314590246127372628.post-4519487133287521481</id><published>2021-04-03T20:40:00.005+05:30</published><updated>2021-09-29T23:31:07.769+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Round H google kickstart retype problem"/><title type='text'>Round H 2020 Google Kick Start Retype Problem| JAVA | Know About</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto&amp;amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;&lt;/link&gt;

&lt;style type=&quot;text/css&quot;&gt;
body{
 margin:0;
}
#para{
color:black; 
       align-items: center;
      font-size: medium;
        font-family:sans-serif;
}

#head{
font-family: sans-serif;
font-size: large;
font-weight: bold;
color:red;
}

textarea{
font-family:sans-serif;
font-size: medium;
color:black;
width: 100%;
height: 85vh; 
box-sizing: border-box;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 10px;
background:antiquewhite;   
padding: 10px 0;
}
&lt;/style&gt;
&lt;/head&gt;

&lt;body id=&quot;para&quot;&gt;
&lt;br/&gt;

&lt;span id=&quot;para&quot;&gt;

&lt;a id=&quot;head&quot;&gt;Problem&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
After spending many hours studying for programming competitions, you decided to take a rest and play video games. You are currently playing an adventure game called Quick Start.  
&lt;br&gt;&lt;br&gt;  
This game has N levels, and you are currently on the K-th level. Unfortunately, you just realized that to beat the boss at the final level, you will need a special sword, which can be picked up at level S. You have already completed that level, but you forgot to pick up the sword at that level.  
&lt;br&gt;&lt;br&gt;  
Now you want to pick up the sword and finish the game in the least amount of time possible, and for that you have two options:  
&lt;br&gt;&lt;br&gt;  
Restart the game and complete all levels again, starting from level 1.&lt;br&gt;
Move to previous levels until you reach level S, pick up the sword and complete all the remaining levels, starting from level S.
&lt;br&gt;&lt;br&gt;  
Every time you enter a level you have to exit it, either by completing it and going to the next level or by moving to a previous level or by finishing / exiting the game. Exiting any level takes 1 minute. That means, for example, that it took you L minutes to complete the first L levels.
&lt;br/&gt;&lt;br/&gt;
Your task is to discover which option would result in the least amount of total time to finish the game (including the time you have already spent).
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Input&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
The first line of the input gives the number of test cases, T. T test cases follow.
&lt;br&gt;&lt;br&gt;  
The first (and only) line of each test case contains three integers N, K and S: the number of levels in the game, the current level you are in, and the level where you have to pick up the sword, respectively.
&lt;br/&gt;&lt;br/&gt;
&lt;a id=&quot;head&quot;&gt;Output&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the least amount of total time to finish the game.
&lt;br/&gt;&lt;br/&gt;

&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0Iir3VKSl7LQW4muwuSvNqdpmT4xy2isvyF6aPPYC_jxfQ-i2VTKQPb-pjD_zgIb9DHImugvYc1UtPMsY9-j5dhuCa6b5v7DdNMNYQCpMkk5hyphenhyphenP_PFoZIVKdwxAnS5K-PGRivjEWiz7B1/s381/Screenshot+%2528830%2529.png&quot; style=&quot;display: block; padding: 1em 0; text-align: center; &quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; width=&quot;400&quot; data-original-height=&quot;219&quot; data-original-width=&quot;381&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0Iir3VKSl7LQW4muwuSvNqdpmT4xy2isvyF6aPPYC_jxfQ-i2VTKQPb-pjD_zgIb9DHImugvYc1UtPMsY9-j5dhuCa6b5v7DdNMNYQCpMkk5hyphenhyphenP_PFoZIVKdwxAnS5K-PGRivjEWiz7B1/s400/Screenshot+%2528830%2529.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;&lt;br/&gt;
  
In Sample Case #1, it took you 4 minutes to complete the first 4 levels and enter 5-th level. Restarting the game and completing all levels again would take 11 more minutes (1 minute to restart and 10 to complete 10 levels), which adds up to 15 minutes. The other option would be to move backwards until you reach level 2 (which would take 3 minutes), and then complete all the remaining levels (taking 9 more minutes), which would result in a total of 16 minutes.&lt;br/&gt;
In Sample Case #2, it took you 6 minutes to complete the first 6 levels and enter 7-th level. Moving backwards until reaching level 6 (one minute), and then completing all the remaining levels (5 minutes), would take a total of 12 minutes to finish the game.&lt;br/&gt;
&lt;/span&gt;

&lt;br/&gt;&lt;br/&gt;
  
&lt;script async src=&quot;https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8963593429134655&quot;
     crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
&lt;ins class=&quot;adsbygoogle&quot;
     style=&quot;display:block; text-align:center;&quot;
     data-ad-layout=&quot;in-article&quot;
     data-ad-format=&quot;fluid&quot;
     data-ad-client=&quot;ca-pub-8963593429134655&quot;
     data-ad-slot=&quot;3245859952&quot;&gt;&lt;/ins&gt;
&lt;script&gt;
     (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;

&lt;span id=&quot;head&quot;&gt;PROGRAM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;

&lt;span id=&quot;para&quot;&gt;
If the level where you have to pick up the sword + 1 (Exiting any level takes 1 minute) is smaller than or equal to current level - level where you have to pick up the sword means you will get the least amount of total time to finish the game is by adding Total Number of Levels + Current Level. If the level where you have to pick up the sword + 1 (Exiting any level takes 1 minute) is greater than the current level - level where you have to pick up the sword means you have to find the least finish time by Current Level + (Current Level - Sword Level) + (Total Number of Levels - Sword Level).
&lt;/span&gt;

&lt;br /&gt;&lt;br /&gt;
&lt;textarea  wrap=&quot;off&quot;&gt;
    import java.io.*;
    import java.util.*;

    public class Solution {

	public static void main(String[] args) {
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int t = sc.nextInt();
		int c=1;
		while(t&gt;0) {
			int n =sc.nextInt();
			int k =sc.nextInt();
			int s =sc.nextInt();
			int y=0;
			if(s+1 &gt; k-s) y = k+k-s+n-s;
			else y = n+k;
			System.out.printf(&quot;Case #%d: %d\n&quot;,c++,y);
			t--;
	  }
	 }
    }
&lt;/textarea&gt;

&lt;br /&gt;&lt;br/&gt;
  &lt;a href=&quot;https://www.knowsabouts.in/2021/03/round-2020-google-kick-start-plates.html&quot;&gt;Here is the link for Google KickStart Round A 2020 Plates problem using JAVA.&lt;/a&gt;
  &lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.knowsabouts.in/feeds/4519487133287521481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.knowsabouts.in/2021/04/round-h-2020-google-kick-start-retype.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4519487133287521481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4314590246127372628/posts/default/4519487133287521481'/><link rel='alternate' type='text/html' href='http://www.knowsabouts.in/2021/04/round-h-2020-google-kick-start-retype.html' title='Round H 2020 Google Kick Start Retype Problem| JAVA | Know About'/><author><name>Gokul&#39;s Google Page</name><uri>http://www.blogger.com/profile/18384991050802094470</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJLm6O0_9W_7aPrHkdgGxgH4Zhp2Lo8jpnBbh5-qD1tKJkL0JKRzAI3O5yNP6AnG78esLXJ8PWmHWqN40JO52JqLePLm-HczXZlX4-yriy0xVTZwyZc2OiG32wLW36zg/s150/AhNQCal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0Iir3VKSl7LQW4muwuSvNqdpmT4xy2isvyF6aPPYC_jxfQ-i2VTKQPb-pjD_zgIb9DHImugvYc1UtPMsY9-j5dhuCa6b5v7DdNMNYQCpMkk5hyphenhyphenP_PFoZIVKdwxAnS5K-PGRivjEWiz7B1/s72-c/Screenshot+%2528830%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>