code-rag-bench/online-tutorials huggingface dataset:
How to create a responsive navigation menu with a login form inside it?

Following is the code to create a responsive navigation menu with a login form inside of it −
 Live Demo
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
body {
   margin: 0px;
   margin-top: 10px;
   padding: 0px;
}
nav {
   width: 100%;
   background-color: rgb(39, 39, 39);
   overflow: auto;
   height: auto;
}
.links {
   display: inline-block;
   text-align: center;
   padding: 14px;
   color: rgb(178, 137, 253);
   text-decoration: none;
   font-size: 17px;
}
.links:hover {
   background-color: rgb(100, 100, 100);
}
form {
   float: right;
   margin-top: 8px;
}
form input{
   display: inline-block;
   padding: 6px;
   font-size: 17px;
   margin-right: 8px;
   border:none;
}
.selected {
   background-color: rgb(0, 18, 43);
}
@media screen and (max-width: 977px) {
.links {
   display: block;
}
form {
   display: block;
   color:white;
}
form input{
   margin-right: 0px;
   display: block;
   width: 100vw;
   margin: 0px;
   border-bottom: 2px solid rgb(178, 137, 253);
   text-align: center;
}
}
</style>
</head>
<body>
   <nav>
      <a class="links selected" href="#">
         Home
      </a>
      <a class="links" href="#">
         Login
      </a>
      <a class="links" href="#">
         Register
      </a>
      <a class="links" href="#">
         Contact Us
      </a>
      <a class="links" href="#">
         More Info
      </a>
      <form>
         <input type="text" placeholder="UserName..." />
         <input type="password" placeholder="Password...">
      </form>
   </nav>
</body>
</html>
This will produce the following output −
On resizing the screen, the content inside nav will reflow as follows −
SQL | INSERT IGNORE Statement - GeeksforGeeks

21 Mar, 2018
We know that a primary key of a table cannot be duplicated. For instance, the roll number of a student in the student table must always be distinct. Similarly, the EmployeeID is expected to be unique in an employee table. When we try to insert a tuple into a table where the primary key is repeated, it results in an error. However, with the INSERT IGNORE statement, we can prevent such errors from popping up, especially when inserting entries in bulk and such errors can interrupt the flow of insertion. Instead, only a warning is generated.
Cases where INSERT IGNORE avoids error
Upon insertion of a duplicate key where the column must contain a PRIMARY KEY or UNIQUE constraint
Upon insertion of NULL value where the column has a NOT NULL constraint.
Upon insertion of a row to a partitioned table where the inserted values go against the partition format.
Example:
Say we have a relation, Employee.
Employee Table:
As we can notice, the entries are not sorted on the basis of their primary key, i.e. EmployeeID.
Sample Query:
INSERT IGNORE INTO Employee (EmployeeID, Name, City)
VALUES (15002, 'Ram', 'Mumbai');

Output:No entry inserted.
Sample Query:
Inserting multiple records
When inserting multiple records at once, any that cannot be inserting will not be, but any that can will be:
INSERT IGNORE INTO Employee (EmployeeID, Name, City)
VALUES (15007, 'Shikha', 'Delhi'), (15002, 'Ram', 'Mumbai'), (15009, 'Sam', 'Ahmedabad');

Output:The first and the last entries get inserted; the middle entry is simple ignored. No error is flashed.
Disadvantage
Most users do not prefer INSERT IGNORE over INSERT since some errors may slip unnoticed. This may cause inconsistencies in the table, thereby causing some tuples to not get inserted without the user having a chance to correct them. Hence, INSERT IGNORE must be used in very specific conditions.
This article is contributed by Anannya Uberoi. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
SQL-Clauses-Operators
SQL
SQL
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
SQL Trigger | Student Database
CTE in SQL
SQL Interview Questions
How to Update Multiple Columns in Single Update Statement in SQL?
How to Create a Table With Multiple Foreign Keys in SQL?
SQL | GROUP BY
SQL | Views
Difference between DELETE, DROP and TRUNCATE
MySQL | Group_CONCAT() Function
SQL - ORDER BY
Container for embedded content (16:9 aspect ratio) in Bootstrap

Use the .embed-responsive class in Bootstrap to set a container for embedded content.
For 16:9 aspect ratio for the embedded content, use the embed-responsive-16by9 class
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "container">
         <h2>Eclipse Refactoring</h2>
         <p>To refactor code in Eclipse, try the below given steps in the video:</p>
         <div class = "embed-responsive embed-responsive-16by9">
            <iframe class = "embed-responsive-item" src = "https://www.youtube.com/embed/YFVV6RAUnNg "></iframe>
         </div>
      </div>
   </body>
</html>
Explain Net operating income theory of capital structure.

Capital structure of a company depends on mix or ratio of debt and equity in their mode of their
financing. Depending on what company prefer, some may have more debt or more equity in financing
their asset, but final goal is to maximize their market value and their profits.
Net operating income (NOI) was developed by David Durand. According to net operating income approach, firm value is not affected by change in company or firm’s debt components.
Net operating income approach says that value of a firm depends on operating income and associated
business risk. Value of firm will not be affected by change in debt components.
Assumptions are as follows −
Debt and equity are source of financing.
Debt and equity are source of financing.
Dividend pay-out ratio is 1.
Dividend pay-out ratio is 1.
No taxes.
No taxes.
No retained earnings.
No retained earnings.
Constant debt capitalisation.
Constant debt capitalisation.
Constant WACC.
Constant WACC.
Difference between firm value and value of debt is value of equity.
Difference between firm value and value of debt is value of equity.
Cost of equity is larger than cost of debt.
Cost of equity is larger than cost of debt.
Market value of a firm (V) is ratio of earnings before income taxes (EBIT) and weighted average cost of capital (WACC).
V = EBIT/WACC
Total equity (E) is difference of market value of a firm (V) and market value of Debt (D).
E = V – D
Cost of equity (Ke) is ratio of difference between Earnings per share (EBIT) and interest (I) to market value of equity shareholder’s (Es).
Ke= (EBIT-I)/Es
Disadvantages of NOI are as follows −
No corporate tax.
No corporate tax.
If cost of debt increases, then financial leverage also increases which also, increases the capital cost.
If cost of debt increases, then financial leverage also increases which also, increases the capital cost.
Investors will have different view of firm’s having high debt in their capital structure.
Investors will have different view of firm’s having high debt in their capital structure.
String Property codeUnits

Returns a list of the UTF-16 code units of a given string.
String.codeUnits

void main() { 
   String str = "Hello"; 
   print(str.codeUnits); 
} 
It will produce the following output −.
[72, 101, 108, 108, 111] 


    44 Lectures 
     4.5 hours 

 Sriyank Siddhartha

    34 Lectures 
     4 hours 

 Sriyank Siddhartha

    69 Lectures 
     4 hours 

 Frahaan Hussain

    117 Lectures 
     10 hours 

 Frahaan Hussain

    22 Lectures 
     1.5 hours 

 Pranjal Srivastava

    34 Lectures 
     3 hours 

 Pranjal Srivastava
 Print
 Add Notes
 Bookmark this page
\leqslant - Tex Command

\leqslant - Used to draw less than or equal to symbol.
{ \leqslant }
\leqslant command is used to draw less than or equal to symbol.

\leqslant

⩽



\leqslant

⩽


\leqslant

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
How to create a temporary MySQL table in a SELECT statement without a separate CREATE TABLE?

To create a temporary table in a SELECT statement we use TEMPORARY keyword.
This temporary table will be visible for the current session and whenever a session is closed, it is automatically destroyed. Two sessions can use the same temporary table.
Creating a table.
mysql> create table MyTableDemo
   -> (
   -> id int,
   -> Name varchar(100)
   -> );
Query OK, 0 rows affected (0.69 sec)
Inserting some records.
mysql> insert into MyTableDemo values(1,'John');
Query OK, 1 row affected (0.18 sec)

mysql>  insert into MyTableDemo values(2,'Carol');
Query OK, 1 row affected (0.13 sec)

mysql>  insert into MyTableDemo values(3,'Bob');
Query OK, 1 row affected (0.12 sec)
To display all records.
mysql> select *from MyTemporaryTableDemo;
Here is the output.
+------+-------+
| id   | Name  |
+------+-------+
|    1 | John  |
|    2 | Carol |
|    3 | Bob   |
+------+-------+
3 rows in set (0.00 sec)

The syntax to create a temporary table.
 CREATE TEMPORARY TABLE IF NOT EXISTS yourTemporaryTableName AS (SELECT * FROM yourTableName);
Let us now implement the above syntax in the following query −
mysql> CREATE TEMPORARY TABLE IF NOT EXISTS MyTemporaryTableDemo AS (SELECT * FROM MyTableDemo);
Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0
To check if all records are copied successfully.
mysql> select *from MyTemporaryTableDemo;
Here is the output.
+------+-------+
| id   | Name  |
+------+-------+
|    1 | John  |
|    2 | Carol |
|    3 | Bob   |
+------+-------+
3 rows in set (0.00 sec)
\overbrace - Tex Command

\overbrace - Used to put a (stretchy) over-brace over the argument.
{ \overbrace #1}
\overbrace command puts a (stretchy) over-brace over the argument. Can use '^' to place an optional superscript over the overbrace; can use ‘_’ to place an optional subscript below the argument.

\overbrace{x + \cdots + x}^{n\rm\ times}_{\text{(note here)}}

x+⋯+x⏞(note here)n times



\overbrace{x + \cdots + x}^{n\rm\ times}_{\text{(note here)}}

x+⋯+x⏞(note here)n times


\overbrace{x + \cdots + x}^{n\rm\ times}_{\text{(note here)}}

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Java - String trim() Method

This method returns a copy of the string, with leading and trailing whitespace omitted.
Here is the syntax of this method −
public String trim()

Here is the detail of parameters −
NA
NA
It returns a copy of this string with leading and trailing white space removed, or this string if it has no leading or trailing white space.
It returns a copy of this string with leading and trailing white space removed, or this string if it has no leading or trailing white space.
import java.io.*;
public class Test {

   public static void main(String args[]) {
      String Str = new String("   Welcome to Tutorialspoint.com   ");

      System.out.print("Return Value :" );
      System.out.println(Str.trim() );
   }
}
This will produce the following result −
Return Value :Welcome to Tutorialspoint.com


    16 Lectures 
     2 hours 

 Malhar Lathkar

    19 Lectures 
     5 hours 

 Malhar Lathkar

    25 Lectures 
     2.5 hours 

 Anadi Sharma

    126 Lectures 
     7 hours 

  Tushar Kale

    119 Lectures 
     17.5 hours 

 Monica Mittal

    76 Lectures 
     7 hours 

 Arnab Chakraborty
 Print
 Add Notes
 Bookmark this page
Singleton Class in C#

Singleton Class allow for single allocations and instances of data. It has normal methods and you can call it using an instance.
To prevent multiple instances of the class, the private constructor is used.
Let us see an example −
public class Singleton {
   static Singleton b = null;
   private Singleton() {
      }  
}
The following is another example displaying how to display Singleton class −
 Live Demo
using System;

class Singleton {
   public static readonly Singleton _obj = new Singleton();
     
   public void Display() {
      Console.WriteLine(true);
   }
   Singleton() {}
}

class Demo {
   public static void Main() {
      Singleton._obj.Display();
   }
}
True
Create a Stack and Queue using ArrayDeque in Java

Create a stack using ArrayDeque.
Deque<String> s = new ArrayDeque<String>();
// stack
s.push("Bat");
s.push("Mat");
s.push("Cat");
s.push("Rat");
s.push("Hat");
s.push("Fat");
Create a queue using ArrayDeque −
Deque<String> q = new ArrayDeque<String>();
// queue
q.add("Bat");
q.add("Mat");
q.add("Cat");
q.add("Rat");
q.add("Hat");
q.add("Fat");
The following is an example.
 Live Demo
import java.util.ArrayDeque;
import java.util.Deque;
public class Demo {
   public static void main(String args[]) {
      Deque<String> s = new ArrayDeque<String>();
      Deque<String> q = new ArrayDeque<String>();
      // stack
      s.push("Bat");
      s.push("Mat");
      s.push("Cat");
      s.push("Rat");
      s.push("Hat");
      s.push("Fat");
      while (!s.isEmpty())
         System.out.print(s.pop() + " ");
      System.out.print("\n");
      // queue
      q.add("Bat");
      q.add("Mat");
      q.add("Cat");
      q.add("Rat");
      q.add("Hat");
      q.add("Fat");
      while (!q.isEmpty())
         System.out.print(q.remove() + " ");
   }
}
Fat Hat Rat Cat Mat Bat
Bat Mat Cat Rat Hat Fat
How to convert a binary matrix to logical matrix in R?

A binary matrix contains values such as Yes or NO, 1 or 0, or any other two values that represents opposite mostly and the globally accepted logical values are FALSE and TRUE. Therefore, to convert a binary matrix to logical matrix, we can use ifelse function and convert the one category of binary variable to appropriate logical value and for the rest returns the left-out value. This is a very easy task in R, check out the below examples to understand how it can be done.
Live Demo
> M1<-matrix(sample(c("No","Yes"),40,replace=TRUE),nrow=20)
> M1
[,1] [,2]
[1,] "No" "Yes"
[2,] "No" "No"
[3,] "No" "Yes"
[4,] "Yes" "Yes"
[5,] "Yes" "Yes"
[6,] "No" "No"
[7,] "Yes" "No"
[8,] "Yes" "Yes"
[9,] "No" "No"
[10,] "No" "Yes"
[11,] "No" "No"
[12,] "Yes" "Yes"
[13,] "No" "No"
[14,] "Yes" "Yes"
[15,] "No" "Yes"
[16,] "No" "No"
[17,] "Yes" "No"
[18,] "Yes" "No"
[19,] "Yes" "No"
[20,] "Yes" "Yes"
Converting M1 to a logical matrix −
> M1[,]<-ifelse(M1 %in% c("No"),FALSE,TRUE)
> M1
[,1] [,2]
[1,] "FALSE" "TRUE"
[2,] "FALSE" "FALSE"
[3,] "FALSE" "TRUE"
[4,] "TRUE" "TRUE"
[5,] "TRUE" "TRUE"
[6,] "FALSE" "FALSE"
[7,] "TRUE" "FALSE"
[8,] "TRUE" "TRUE"
[9,] "FALSE" "FALSE"
[10,] "FALSE" "TRUE"
[11,] "FALSE" "FALSE"
[12,] "TRUE" "TRUE"
[13,] "FALSE" "FALSE"
[14,] "TRUE" "TRUE"
[15,] "FALSE" "TRUE"
[16,] "FALSE" "FALSE"
[17,] "TRUE" "FALSE"
[18,] "TRUE" "FALSE"
[19,] "TRUE" "FALSE"
[20,] "TRUE" "TRUE"
Live Demo
> M2<-matrix(sample(c("0","1"),40,replace=TRUE),nrow=20)
> M2
[,1] [,2]
[1,] "1" "1"
[2,] "0" "1"
[3,] "1" "0"
[4,] "0" "0"
[5,] "1" "0"
[6,] "1" "1"
[7,] "1" "0"
[8,] "0" "1"
[9,] "0" "0"
[10,] "0" "0"
[11,] "0" "1"
[12,] "0" "0"
[13,] "0" "1"
[14,] "0" "0"
[15,] "1" "1"
[16,] "0" "1"
[17,] "0" "1"
[18,] "1" "0"
[19,] "1" "0"
[20,] "1" "0"
Converting M2 to a logical matrix −
> M2[,]<-ifelse(M2 %in% c("0"),FALSE,TRUE)
> M2
[,1] [,2]
[1,] "TRUE" "TRUE"
[2,] "FALSE" "TRUE"
[3,] "TRUE" "FALSE"
[4,] "FALSE" "FALSE"
[5,] "TRUE" "FALSE"
[6,] "TRUE" "TRUE"
[7,] "TRUE" "FALSE"
[8,] "FALSE" "TRUE"
[9,] "FALSE" "FALSE"
[10,] "FALSE" "FALSE"
[11,] "FALSE" "TRUE"
[12,] "FALSE" "FALSE"
[13,] "FALSE" "TRUE"
[14,] "FALSE" "FALSE"
[15,] "TRUE" "TRUE"
[16,] "FALSE" "TRUE"
[17,] "FALSE" "TRUE"
[18,] "TRUE" "FALSE"
[19,] "TRUE" "FALSE"
[20,] "TRUE" "FALSE"
MongoDB query to display all the values excluding the id?

For this, use the project.Theproject takes a document that can specify the inclusion of fields, the suppression of the _id field, the addition of new fields, and the resetting of the values of existing fields
Let us first create a collection with documents −
> db.demo226.insertOne({"Name":"Chris","Age":21});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5e3f9be803d395bdc2134738")
}
> db.demo226.insertOne({"Name":"Bob","Age":20});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5e3f9bf003d395bdc2134739")
}
> db.demo226.insertOne({"Name":"David","Age":22});
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5e3f9bf803d395bdc213473a")
}
Display all documents from a collection with the help of find() method −
> db.demo226.find();
This will produce the following output −
{ "_id" : ObjectId("5e3f9be803d395bdc2134738"), "Name" : "Chris", "Age" : 21 }
{ "_id" : ObjectId("5e3f9bf003d395bdc2134739"), "Name" : "Bob", "Age" : 20 }
{ "_id" : ObjectId("5e3f9bf803d395bdc213473a"), "Name" : "David", "Age" : 22 }
Following is the query to display all the values excluding id −
> db.demo226.aggregate(
...   {$project:
...      {
...         _id: false,
..."         StudentFirstName":"$Name",
...         "StudentAge":"$Age"
...      }
...   }
...);
This will produce the following output −
{ "StudentFirstName" : "Chris", "StudentAge" : 21 }
{ "StudentFirstName" : "Bob", "StudentAge" : 20 }
{ "StudentFirstName" : "David", "StudentAge" : 22 }
JavaScript - RegExp test Method

The test method searches string for text that matches regexp. If it finds a match, it returns true; otherwise, it returns false.
Its syntax is as follows −
RegExpObject.test( string );

string  − The string to be searched
Returns the matched text if a match is found, and null if not.
Try the following example program.
<html>
   <head>
      <title>JavaScript RegExp test Method</title>
   </head>
   
   <body>
      <script type = "text/javascript">
         var str = "Javascript is an interesting scripting language";
         var re = new RegExp( "script", "g" );
         
         var result = re.test(str);
         document.write("Test 1 - returned value : " +  result); 
         
         re = new RegExp( "pushing", "g" );
         
         var result = re.test(str);
         document.write("<br />Test 2 - returned value : " +  result); 
      </script>
   </body>
</html>
Test 1 - returned value : true
Test 2 - returned value : false 


    25 Lectures 
     2.5 hours 

 Anadi Sharma

    74 Lectures 
     10 hours 

 Lets Kode It

    72 Lectures 
     4.5 hours 

 Frahaan Hussain

    70 Lectures 
     4.5 hours 

 Frahaan Hussain

    46 Lectures 
     6 hours 

 Eduonix Learning Solutions

    88 Lectures 
     14 hours 

 Eduonix Learning Solutions
 Print
 Add Notes
 Bookmark this page
Python dictionary fromkeys() Method

Python dictionary  method fromkeys() creates a new dictionary with keys from seq and values set to value.
Following is the syntax for fromkeys() method −
dict.fromkeys(seq[, value])

seq − This is the list of values which would be used for dictionary keys preparation.
seq − This is the list of values which would be used for dictionary keys preparation.
value − This is optional, if provided then value would be set to this value
value − This is optional, if provided then value would be set to this value
This method returns the list.
The following example shows the usage of fromkeys() method.
#!/usr/bin/python

seq = ('name', 'age', 'sex')
dict = dict.fromkeys(seq)
print "New Dictionary : %s" %  str(dict)

dict = dict.fromkeys(seq, 10)
print "New Dictionary : %s" %  str(dict)
When we run above program, it produces following result −
New Dictionary : {'age': None, 'name': None, 'sex': None}
New Dictionary : {'age': 10, 'name': 10, 'sex': 10}


    187 Lectures 
     17.5 hours 

 Malhar Lathkar

    55 Lectures 
     8 hours 

 Arnab Chakraborty

    136 Lectures 
     11 hours 

 In28Minutes Official

    75 Lectures 
     13 hours 

 Eduonix Learning Solutions

    70 Lectures 
     8.5 hours 

 Lets Kode It

    63 Lectures 
     6 hours 

 Abhilash Nelson
 Print
 Add Notes
 Bookmark this page
Generate Parentheses in Python

Suppose we have a value n. We have to generate all possible well-formed parentheses where n number of opening and closing parentheses are present. So if the value of n = 3, then the parentheses set will be ["()()()","()(())","(())()","(()())","((()))"]
To solve this, we will follow these steps −
Define method called genParenthesisRec(). This takes left, right, temp string and result array. initially result array is empty
The function genParenthesisRec, will work like below
if left = 0 and right := 0, then insert temp into result, and return
if left > 0getParenthesisRec(left – 1, right, temp + “(”, result)
getParenthesisRec(left – 1, right, temp + “(”, result)
if right > leftgetParenthesisRec(left, right – 1, temp + “)”, result)
getParenthesisRec(left, right – 1, temp + “)”, result)
Let us see the following implementation to get a better understanding −
 Live Demo
class Solution(object):
   def generateParenthesis(self, n):
      """
      :type n: int
      :rtype: List[str]
      """
      result = []
      self.generateParenthesisUtil(n,n,"",result)
      return result
   def generateParenthesisUtil(self, left,right,temp,result):
      if left == 0 and right == 0:
         result.append(temp)
         return
      if left>0:
         self.generateParenthesisUtil(left-1,right,temp+'(',result)
      if right > left:
         self.generateParenthesisUtil(left, right-1, temp + ')', result)
ob = Solution()
print(ob.generateParenthesis(4))
4
["(((())))",
"((()()))",
"((())())",
"((()))()",
"(()(()))",
"(()()())",
"(()())()",
"(())(())",
"(())()()",
"()((()))",
"()(()())",
"()(())()",
"()()(())",
"()()()()"]
Calculating the mean of all pixels for each band in an image using the Pillow library

In this program, we will calculate the mean of all the pixels in each channel using the Pillow library. There are a total three channels in an image and therefore, we will get a list of three values.
Step 1: Import the Image and ImageStat libraries.
Step 2: Open the image.
Step 3: Pass the image to the stat function of the imagestat class.
Step 4: Print the mean of the pixels.
from PIL import Image, ImageStat

im = Image.open('image_test.jpg')
stat = ImageStat.Stat(im)
print(stat.mean)
[76.00257724463832, 69.6674300254453, 64.38017448200654]
Can we create non static variables in an interface using java?

Interface in Java is similar to class but, it contains only abstract methods and fields which are final and static.
Since all the methods are abstract you cannot instantiate it. To use it, you need to implement this interface using a class and provide body to all the abstract methods int it.
No you cannot have non-static variables in an interface. By default,
All the members (methods and fields) of an interface are public
All the members (methods and fields) of an interface are public
All the methods in an interface are public and abstract (except static and default).
All the methods in an interface are public and abstract (except static and default).
All the fields of an interface are public, static and, final by default.
All the fields of an interface are public, static and, final by default.
If you declare/define fields without public or, static or, final or, all the three modifiers. Java compiler places them on your behalf.
In the following Java program, we are having a filed without public or, static or, final modifiers.
public interface MyInterface{
   int num = 40;
   void demo();
}
If you compile this using the javac command as shown below −
c:\Examples>javac MyInterface.java
it gets compiled without errors. But, if you verify the interface after compilation using the javap command as shown below −
c:\Examples>javap MyInterface
Compiled from "MyInterface.java"
public interface MyInterface {
   public static final int num;
   public abstract void demo();
}
You can observe that the compiler has placed the public, static and, final modifiers before the field on behalf of you.
How will you travel from child to parent with xpath in Selenium with python?

We can identify a parent from its children in DOM with the help of xpath. There are situations where we have dynamic attributes for the parent node in html but the child nodes have unique static attributes for identification.
This can be achieved with the help of relative xpath along with the parent xpath axe. Method.
driver. find_element_by_xpath("//input[@id='job']/parent::div")
Code Implementation for child to parent traversal.
from selenium import webdriver
#browser exposes an executable file
#Through Selenium test we will invoke the executable file which will then #invoke #actual browser
driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
# to maximize the browser window
driver.maximize_window()
#get method to launch the URL
driver.get("https://www.tutorialspoint.com/tutor_connect/index.php")
#to refresh the browser
driver.refresh()
# identifying the edit box with the help of xpath parent
atb=driver.find_element_by_xpath ("//input[@id='txtSearchText']/parent::div")
#prints the class attribute value in console
val = atb.get_attribute("class")
print(val)
driver.close()
\circledR - Tex Command

\circledR - Used to draw circled R.
{ \circledR }
\circledR command draws circled R.

\circledR

®



\circledR

®


\circledR

    14 Lectures 
     52 mins

 Ashraf Said

    11 Lectures 
     1 hours 

 Ashraf Said

    9 Lectures 
     1 hours 

 Emenwa Global, Ejike IfeanyiChukwu

    29 Lectures 
     2.5 hours 

 Mohammad Nauman

    14 Lectures 
     1 hours 

 Daniel Stern

    15 Lectures 
     47 mins

 Nishant Kumar
 Print
 Add Notes
 Bookmark this page
Overlapping Y-axis tick label and X-axis tick label in Matplotlib

To reduce the chances of overlapping between x and y tick labels in matplotlib, we can take the following steps −
Create x and y data points using numpy.
Create x and y data points using numpy.
Add a subplot to the current figure at index 1 (nrows=1 and ncols=2).
Add a subplot to the current figure at index 1 (nrows=1 and ncols=2).
Set x and y margins to 0.
Set x and y margins to 0.
Plot x and y data points and add a title to this subplot, i.e., "Overlapping".
Plot x and y data points and add a title to this subplot, i.e., "Overlapping".
Add a subplot to the current figure at index 2 (nrows=1 and ncols=2).
Add a subplot to the current figure at index 2 (nrows=1 and ncols=2).
Set x and y margins to 0.
Set x and y margins to 0.
Plot x and y data points and add a title to this subplot, i.e., "Non Overlapping".
Plot x and y data points and add a title to this subplot, i.e., "Non Overlapping".
The objective of MaxNLocator and prune ="lower" is that the smallest tick will be removed.
The objective of MaxNLocator and prune ="lower" is that the smallest tick will be removed.
To display the figure, use show() method.
To display the figure, use show() method.
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
import numpy as np
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
xs = np.linspace(0, 5, 10)
ys = np.linspace(0, 5, 10)
plt.subplot(121)
plt.margins(x=0, y=0)
plt.plot(xs, ys)
plt.title("Overlapping")
plt.subplot(122)
plt.margins(x=0, y=0)
plt.plot(xs, ys)
plt.title("Non overlapping")
plt.gca().xaxis.set_major_locator(MaxNLocator(prune='lower'))
plt.gca().yaxis.set_major_locator(MaxNLocator(prune='lower'))
plt.show()
Python Program for Binary Insertion Sort - GeeksforGeeks

25 Feb, 2022
We can use binary search to reduce the number of comparisons in normal insertion sort. Binary Insertion Sort find use binary search to find the proper location to insert the selected item at each iteration.In normal insertion, sort it takes O(i) (at ith iteration) in worst case. we can reduce it to O(logi) by using binary search.
# Python Program implementation  # of binary insertion sort  def binary_search(arr, val, start, end):    # we need to distinguish whether we should insert    # before or after the left boundary.    # imagine [0] is the last step of the binary search    # and we need to decide where to insert -1    if start == end:        if arr[start] > val:            return start        else:            return start+1      # this occurs if we are moving beyond left\'s boundary    # meaning the left boundary is the least position to    # find a number greater than val    if start > end:        return start      mid = (start+end)/2    if arr[mid] < val:        return binary_search(arr, val, mid+1, end)    elif arr[mid] > val:        return binary_search(arr, val, start, mid-1)    else:        return mid  def insertion_sort(arr):    for i in xrange(1, len(arr)):        val = arr[i]        j = binary_search(arr, val, 0, i-1)        arr = arr[:j] + [val] + arr[j:i] + arr[i+1:]    return arr  print("Sorted array:")print insertion_sort([37, 23, 0, 17, 12, 72, 31,                        46, 100, 88, 54])  # Code contributed by Mohit Gupta_OMG 
Please refer complete article on Binary Insertion Sort for more details!
surinderdawra388
Insertion Sort
python sorting-exercises
Python Programs
Sorting
Sorting
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Appending to list in Python dictionary
Python program to interchange first and last elements in a list
Python Program for QuickSort
How to inverse a matrix using NumPy
Differences and Applications of List, Tuple, Set and Dictionary in Python
Pandas Profiling in Python - GeeksforGeeks

22 Jun, 2020
The pandas_profiling library in Python include a method named as ProfileReport() which generate a basic report on the input DataFrame. 
The report consist of the following:
DataFrame overview,
Each attribute on which DataFrame is defined,
Correlations between attributes (Pearson Correlation and Spearman Correlation), and
A sample of DataFrame.
Syntax :
pandas_profiling.ProfileReport(df, **kwargs)
Example:
Python3
# importing packagesimport pandas as pdimport pandas_profiling as pp    # dictionary of datadct = {'ID': {0: 23, 1: 43, 2: 12, 3: 13,               4: 67, 5: 89, 6: 90, 7: 56,               8: 34},        'Name': {0: 'Ram', 1: 'Deep', 2: 'Yash',                3: 'Aman', 4: 'Arjun', 5: 'Aditya',                6: 'Divya', 7: 'Chalsea',                8: 'Akash' },        'Marks': {0: 89, 1: 97, 2: 45, 3: 78,                 4: 56, 5: 76, 6: 100, 7: 87,                 8: 81},        'Grade': {0: 'B', 1: 'A', 2: 'F', 3: 'C',                 4: 'E', 5: 'C', 6: 'A', 7: 'B',                 8: 'B'}      }  # forming dataframe and printingdata = pd.DataFrame(dct)print(data)  # forming ProfileReport and save# as output.html fileprofile = pp.ProfileReport(data)profile.to_file("output.html")
Output:
DataFrame
The html file named as output.html is as follows :
Python-pandas
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Read a file line by line in Python
How to Install PIP on Windows ?
Enumerate() in Python
Different ways to create Pandas Dataframe
Iterate over a list in Python
Python String | replace()
*args and **kwargs in Python
Reading and Writing to text files in Python
Create a Pandas DataFrame from Lists
How to Remove rows in Numpy array that contains non-numeric values? - GeeksforGeeks

25 Oct, 2020
Many times we have non-numeric values in NumPy array. These values need to be removed, so that array will be free from all these unnecessary values and look more decent. It is possible to remove all rows containing Nan values using the Bitwise NOT operator and np.isnan() function.
Example 1:
Python3
# Importing Numpy moduleimport numpy as np  # Creating 2X3 2-D Numpy arrayn_arr = np.array([[10.5, 22.5, 3.8],                  [41, np.nan, np.nan]])  print("Given array:")print(n_arr)  print("\nRemove all rows containing non-numeric elements")print(n_arr[~np.isnan(n_arr).any(axis=1)])
Output:
In the above example, we remove row containing non-numeric values from the 2X3 Numpy array.
Example 2:
Python3
# Importing Numpy module import numpy as np  # Creating 3X3 2-D Numpy arrayn_arr = np.array([[10.5, 22.5, 3.8],                   [23.45, 50, 78.7],                  [41, np.nan, np.nan]])  print("Given array:")print(n_arr)  print("\nRemove all rows containing non-numeric elements")print(n_arr[~np.isnan(n_arr).any(axis=1)])
Output:
In the above example, we remove row containing non-numeric values from the 3X3 Numpy array.
Example 3:
Python3
# Importing Numpy moduleimport numpy as np  # Creating 5X4 2-D Numpy arrayn_arr = np.array([[10.5, 22.5, 3.8, 5],                  [23.45, 50, 78.7, 3.5],                  [41, np.nan, np.nan, 0],                  [20, 50.20, np.nan, 2.5],                  [18.8, 50.60, 8.8, 58.6]])  print("Given array:")print(n_arr)  print("\nRemove all rows containing non-numeric elements")print(n_arr[~np.isnan(n_arr).any(axis=1)])
Output:
In the above example, we remove rows containing non-numeric values from the 5X4 Numpy array.
Python numpy-Logic Functions
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
Python | os.path.join() method
Python | Get unique values from a list
Create a directory in Python
Defaultdict in Python
Python | Pandas dataframe.groupby()
How to Disable an datepicker in jQuery UI ? - GeeksforGeeks

27 Jan, 2021
To disable a datepicker in jQuery UI we will be using disable() method which is discussed below:
jQuery UI disable() method is used to disable the datepicker.
Syntax:
$( ".selector" ).datepicker( "disable" )
Parameters: This method does not accept any parameters.
Return values: This method returns an object value
Approach: First, add jQuery UI scripts needed for your project.
<<link href = "https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel = "stylesheet">
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
<script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
Example:
HTML
<!DOCTYPE html><html lang="en">  <head>    <meta charset="utf-8" />    <link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"        rel="stylesheet" />    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>          <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js">    </script>      <script>        $(function() {            $("#gfg").datepicker();            $("#gfg").datepicker("disable");        });    </script></head>  <body>    <p>Enter Date: <input type="text" id="gfg" /></p></body>  </html>
Output:
jQuery-UI
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Show and Hide div elements using radio buttons?
How to prevent Body from scrolling when a modal is opened using jQuery ?
jQuery | ajax() Method
jQuery | removeAttr() with Examples
How to get the value in an input text box using jQuery ?
Remove elements from a JavaScript Array
Installation of Node.js on Linux
Convert a string to an integer in JavaScript
How to fetch data from an API in ReactJS ?
How to insert spaces/tabs in text using HTML/CSS?
GATE | GATE CS 2008 | Question 63 - GeeksforGeeks

02 Dec, 2021
The P and V operations on counting semaphores, where s is a counting semaphore, are defined as follows:
P(s) : s =  s - 1;
  if (s  < 0) then wait;
V(s) : s = s + 1;
  if (s <= 0) then wakeup a process waiting on s;
Assume that Pb and Vb the wait and signal operations on binary semaphores are provided. Two binary semaphores Xb and Yb are used to implement the semaphore operations P(s) and V(s) as follows:
P(s) : Pb(Xb);
  s = s - 1;
  if (s < 0) {
   Vb(Xb) ;
   Pb(Yb) ;
  }
  else Vb(Xb); 

V(s) : Pb(Xb) ;
  s = s + 1;
  if (s <= 0) Vb(Yb) ;
  Vb(Xb) ;
The initial values of Xb and Yb are respectively
(A) 0 and 0(B) 0 and 1
(C) 1 and 0
(D) 1 and 1Answer: (C)Explanation: Suppose Xb = 0, then because of P(s): Pb(Xb) operation, Xb will be -1 and process will get blocked as it will enter into waiting section. 
So, Xb will be one. 
Suppose s=2(means 2 process are accessing shared resource), taking Xb as 1,
first P(s): Pb(Xb) operation will make Xb as zero. s will be 1 and Then Vb(Xb) operation will be executed which will increase the count of Xb as one. Then same process will be repeated making Xb as one and s as zero.
Now suppose one more process comes, then Xb will be 0 but s will be -1 which will make this process go into loop (s <0) and will result into calling Vb(Xb) and Pb(Yb) operations. Vb(Xb) will result into Xb as 1 and Pb(Yb) will result into decrementing the value of Yb.case 1: if Yb has value as 0, it will be -1 and it will go into waiting and will be blocked.total 2 process will access shared resource (according to counting semaphore, max 3 process can access shared resource) and value of s is -1 means only 1 process will be waiting for resources and just now, one process got blocked. So it is still true.
case 2: if Yb has value as 1, it will be 0. Total 3 process will access shared resource (according to counting semaphore, max 2 process can access shared resource) and value of s is -1 means only 1 process will be waiting for resources and but there is no process waiting for resources.So it is false.
See Question 2 of https://www.geeksforgeeks.org/operating-systems-set-10/ 
This solution is contributed by Nitika Bansal
Quiz of this Question
harshilmarwah
kk773572498
GATE-CS-2008
GATE-GATE CS 2008
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
GATE | Gate IT 2007 | Question 25
GATE | GATE-CS-2001 | Question 39
GATE | GATE-CS-2000 | Question 41
GATE | GATE-CS-2005 | Question 6
GATE | GATE MOCK 2017 | Question 21
GATE | GATE MOCK 2017 | Question 24
GATE | GATE-CS-2006 | Question 47
GATE | Gate IT 2008 | Question 43
GATE | GATE-CS-2009 | Question 38
GATE | GATE-CS-2003 | Question 90
Python - Matrix Row subset - GeeksforGeeks

30 Dec, 2020
Sometimes, while working with Python Matrix, one can have a problem in which, one needs to extract all the rows that are a possible subset of any row of other Matrix. This kind of problem can have application in data domains as a matrix is a key data type in those domains. Let’s discuss certain ways in which this problem can be solved.
Input : test_list = [[4, 5, 7], [2, 3, 4], [9, 8, 6]], check_matr = [[2, 3], [1, 2], [9, 0]]Output : [[2, 3]]
Input : test_list = [[4, 1, 2], [2, 3, 4], [9, 8, 0]], check_matr = [[2, 3], [1, 2], [9, 0]]Output : [[2, 3], [1, 2], [9, 0]]
Method #1 : Using any() + all() + list comprehensionThe combination of above functions offer a way in which this problem can be solved. In this, we check for occurrence of all elements of row using all() and any() is used to match to any row of Matrix. List comprehension is used to bind the logic together.
# Python3 code to demonstrate working of # Matrix Row subset# Using any() + all() + list comprehension  # initializing liststest_list = [[4, 5, 7], [2, 3, 4], [9, 8, 0]]  # printing original listprint("The original list is : " + str(test_list))  # initializing check Matrixcheck_matr = [[2, 3], [1, 2], [9, 0]]  # Matrix Row subset# Using any() + all() + list comprehensionres = [ele for ele in check_matr if any(all(a in sub for a in ele)                                           for sub in test_list)]  # printing result print("Matrix row subsets : " + str(res)) 
The original list is : [[4, 5, 7], [2, 3, 4], [9, 8, 0]]
Matrix row subsets : [[2, 3], [9, 0]]

 
Method #2 : Using product() + set() + list comprehensionThe combination of above functions can be used for this task. In this, we perform the task of nested loop using product() and set() conversion is to check for subset of one container over other. List comprehension is used to bind all together.
# Python3 code to demonstrate working of # Matrix Row subset# Using product() + set() + list comprehensionimport itertools  # initializing liststest_list = [[4, 5, 7], [2, 3, 4], [9, 8, 0]]  # printing original listprint("The original list is : " + str(test_list))  # initializing check Matrixcheck_matr = [[2, 3], [1, 2], [9, 0]]  # Matrix Row subset# Using product() + set() + list comprehensionres = [a for a, b in itertools.product(check_matr, test_list)                                         if set(a) <= set(b)]  # printing result print("Matrix row subsets : " + str(res)) 
The original list is : [[4, 5, 7], [2, 3, 4], [9, 8, 0]]
Matrix row subsets : [[2, 3], [9, 0]]

Python list-programs
Python matrix-program
Python
Python Programs
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Check if element exists in list in Python
How To Convert Python Dictionary To JSON?
Python Classes and Objects
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Split string into list of characters
Python | Convert a list to dictionary
How to print without newline in Python?
How to use Boto3 to get the details of a connection from AWS Glue Data catalog?

Problem Statement − Use boto3 library in Python to get details of a connection present in AWS Glue Data catalog.
Example − Get the details of a connection definition, ‘aurora-test’.
Step 1 − Import boto3 and botocore exceptions to handle exceptions.
Step 2 − Pass the parameter connection_name whose definition needs to check.
Step 3 − Create an AWS session using boto3 library. Make sure region_name is mentioned in default profile. If it is not mentioned, then explicitly pass the region_name while creating the session.
Step 4 − Create an AWS client for glue.
Step 5 − Call get_connection function and pass the connection_name as Name parameter.
Step 6 − It will fetch the details of the connection definition from AWS Glue Data Catalog.
Step 7 − Handle the generic exception if something went wrong while checking the job.
Use the following code to get definition of a connection in AWS Glue Data catalog −
import boto3
from botocore.exceptions import ClientError

def get_details_of_a_connection(connection_name):
   session = boto3.session.Session()
   glue_client = session.client('glue')
   try:
      response = glue_client.get_connection(Name= connection_name)
      return response
   except ClientError as e:
      raise Exception("boto3 client error in get_details_of_a_connection: " + e.__str__())
   except Exception as e:
      raise Exception("Unexpected error in get_details_of_a_connection: " + e.__str__())
print(get_details_of_a_connection("aurora-poc"))
{'Connection': {'Name': 'aurora-poc', 'ConnectionType': 'JDBC',
'ConnectionProperties': {'JDBC_CONNECTION_URL': 'jdbc:postgresql://abcpostgresql-cluster.cluster-abc.us-east-1.rds.amazonaws.com:0132/abc,
'JDBC_ENFORCE_SSL': 'false', 'PASSWORD': '******', 'USERNAME':
'abc***'}, 'PhysicalConnectionRequirements': {'SubnetId': 'subnet351*****', 'SecurityGroupIdList': ['sg-caa******', 'sg-*************'],
'AvailabilityZone': 'us-east-1c'}, 'CreationTime':
datetime.datetime(2020, 11, 18, 12, 38, 29, 625000, tzinfo=tzlocal()),
'LastUpdatedTime': datetime.datetime(2020, 11, 18, 12, 51, 16, 59000,
tzinfo=tzlocal())}, 'ResponseMetadata': {'RequestId': '6f13524b-4175-
454b-bc60-c7f408967098', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date':
'Sun, 28 Feb 2021 11:19:18 GMT', 'content-type': 'application/x-amzjson-1.1', 'content-length': '523', 'connection': 'keep-alive', 'x-amznrequestid': '6f13524b-*****************7098'}, 'RetryAttempts': 0}}
KitHack – Hacking tools pack in Kali Linux

23 Sep, 2021
KitHack Framework is a free and open-source tool available on GitHub. It is designed to automate the process of downloading and installing different tools for penetration testing, with a special option that allows generating cross-platform backdoors using Metasploit Framework.
The framework has the following options as a menu in which the too provide different tools according to category:
Passwords Attacks
Web Attacks
Spoofing
Information Gathering
Others
Android
Windows
Phishing
WIFI Attacks
Others
Step 1: Open your kali Linux operating system and open the terminal in order to install the tool. Use the following command to install the tool.
git clone https://github.com/AdrMXR/KitHack.git
cd KitHack
Step 2: Now to list out the content of the tool use the following command.
ls
Step 3: Now Install the tool using the following command.
 bash install.sh
Step 4: All the installation has been done now use the following command to run the tool.
python3 KitHack.py
The installation has been done now we will see examples to use the tool.
Example 1: Use the KitHack framework to install the information gathering tool.
Choose option:
08
Here we have chosen the 08 option to go into the information gathering submenu.
Now we are downloading a tool called gasmask from the menu so we have chosen 11
KitHack frameworks started downloading the tool from GitHub. This is how KitHack framework makes it easy to security researchers to download all the tools of need from a single place. 
Kali-Linux
Linux-Tools
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Docker - COPY Instruction
scp command in Linux with Examples
chown command in Linux with Examples
SED command in Linux | Set 2
nohup Command in Linux with Examples
mv command in Linux with examples
chmod command in Linux with examples
Array Basics in Shell Scripting | Set 1
Introduction to Linux Operating System
Basic Operators in Shell Scripting
PHP | strcasecmp() Function

28 Nov, 2018
The strcasecmp() function is a built-in function in PHP and is used to compare two given strings. It is case-insensitive. This function is similar to strncasecmp(), the only difference is that the strncasecmp() provides the provision to specify the number of characters to be used from each string for the comparison.
Syntax:
strcasecmp($string1, $string2)
Parameters: This function accepts two mandatory parameters as shown in the above syntax and are described below:
$string1, $string2: These parameters specify the strings to be compared.
Return Value:This function returns an integer based on the conditions as described below:
strcasecmp() returns 0 – if the two strings are equal.
strcasecmp() returns < 0 – if string1 is less than string2
strcasecmp() returns > 0 – if string1 is greater than string2
Examples:
Input : $str1 = "Geeks for Geeks "
        $str2 = "Geeks for Geeks "
Output : 0

Input : $str1 = "Geeks for Geeks"
        $str2 = "Hello Geek!"
Output : -1

Below programs illustrate the strcasecmp() function in PHP:
Program 1: When the two strings are identical:
<?php// PHP program to demonstrate the use// of strcasecmp() function  $str1 = "Geeks for Geeks ";$str2 = "Geeks for Geeks ";   // Both the strings are equal$test=strcasecmp($str1, $str2);    echo "$test";    ?>
Output:
0
Program 2: When the two strings are not identical:
<?php// PHP program to demonstrate the use// of strcasecmp() function  $str1 = "Geeks for Geeks";$str2 = "Hello Geek!";   // Both the strings are not equal//  str1 < str2   $test = strcasecmp($str1, $str2);    echo "$test";    ?>
Output:
-1
Program 3: When the two strings are not identical:
<?php// PHP program to demonstrate the use// of strcasecmp() function$str1 = "Hello Geek!";$str2 = "Geeks for Geeks";     // Both the strings are not equal//  str1 > str2 $test = strcasecmp($str1, $str2);    echo "$test";    ?>
Output:
1
Reference:http://php.net/manual/en/function.strcasecmp.php
anupamsworld
PHP-string
PHP
Web Technologies
PHP
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.