code-rag-bench/online-tutorials huggingface dataset:
C# | Get the last node of the LinkedList<T> - GeeksforGeeks

01 Feb, 2019
LinkedList<T>.Last property is used to get the last node of the LinkedList<T>.
Syntax:
public System.Collections.Generic.LinkedListNode Last { get; }

Return Value: The last LinkedListNode<T> of the LinkedList<T>.
Below given are some examples to understand the implementation in a better way:
Example 1:
// C# code to get the last// node of the LinkedListusing System;using System.Collections;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {        // Creating a LinkedList of Strings        LinkedList<String> myList = new LinkedList<String>();          // Adding nodes in LinkedList        myList.AddLast("A");        myList.AddLast("B");        myList.AddLast("C");        myList.AddLast("D");        myList.AddLast("E");          // To get the last node of the LinkedList        if (myList.Count > 0)            Console.WriteLine(myList.Last.Value);        else            Console.WriteLine("LinkedList is empty");    }}
Output:
E

Example 2:
// C# code to get the last// node of the LinkedListusing System;using System.Collections;using System.Collections.Generic;  class GFG {      // Driver code    public static void Main()    {        // Creating a LinkedList of Integers        LinkedList<int> myList = new LinkedList<int>();          // To get the last node of the LinkedList        if (myList.Count > 0)            Console.WriteLine(myList.Last.Value);        else            Console.WriteLine("LinkedList is empty");    }}
Output:
LinkedList is empty

Note:
LinkedList accepts null as a valid Value for reference types and allows duplicate values.
If the LinkedList is empty, the First and Last properties contain null.
Retrieving the value of this property is an O(1) operation.
Reference:
https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.linkedlist-1.last?view=netframework-4.7.2
CSharp-Generic-Namespace
CSharp-LinkedList
C#
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Destructors in C#
Extension Method in C#
HashSet in C# with Examples
Top 50 C# Interview Questions & Answers
C# | How to insert an element in an Array?
C# | Inheritance
Partial Classes in C#
C# | List Class
Difference between Hashtable and Dictionary in C#
Linked List Implementation in C#
How to create a bar chart using ggplot2 with facets that are in the order of the data in R?

Since visualization is an essential part of data analysis, we should make sure that the plots are created in a form that is easily readable for users. For this purpose, the facets in a bar chart helps us to understand the factor variable levels for another factor. To create such type of bar chart, we can use facet_grid function of ggplot2 package.
Consider the below data frame −
> set.seed(99)
> y<-sample(1:100,50,replace=TRUE)
> class<-rep(c(letters[1:5]),times=10)
> quantity<-as.factor(rep(c(5,10,15,20,25),each=10))
> df<-data.frame(y,class,quantity)
Here, we have class and quantity as factor variables. Suppose we want to use quantity as a facet.
Loading ggplot2 package −
> library(ggplot2)
Creating the plot with class on X-axis and y on Y-axis without any facet −
> ggplot(df,aes(class,y))+
+ geom_bar(stat="identity")
Creating the plot with class on X-axis, y on Y-axis, and quantity as facet −
> ggplot(df,aes(class,y))+
+ geom_bar(stat="identity")+
+ facet_grid(.~quantity)
How to Install glob in Python on MacOS? - GeeksforGeeks

17 Feb, 2022
In this article, we will learn how to install glob in Python on MacOS.
Glob is a general term used to define techniques to match specified patterns according to rules related to Unix shell. Linux and Unix systems and shells also support glob and also provide function glob() in system libraries.
Follow the below steps to install glob package on macOS using pip:
Step 1: Install latest Python3 in MacOS
Step 2: Check if pip3 and python3 are correctly installed.
python3 --version
pip3 --version
Step 3: Upgrade your pip to avoid errors during installation.
pip3 install --upgrade pip
Step 4: Enter the following command to install glob2 using pip3.
pip3 install glob2
Follow the below steps to install pyusb package on macOS using the setup.py file:
Step 1: Download the latest source package of glob2 for python3 from here.
curl https://files.pythonhosted.org/packages/d7/a5/bbbc3b74a94fbdbd7915e7ad030f16539bfdc1362f7e9003b594f0537950/glob2-0.7.tar.gz > glob.tar.gz
Step 2: Extract the downloaded package using the following command.
tar -xzvf glob.tar.gz
Step 3: Go inside the folder and Enter the following command to install the package.
cd glob2-0.7
python3 setup.py install
Make the following import in your python terminal to verify if the installation has been done properly:
import glob2
If there is any error while importing the module then is not installed properly.
sumitgumber28
Blogathon-2021
how-to-install
Picked
Blogathon
How To
Installation Guide
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Create a Table With Multiple Foreign Keys in SQL?
How to Import JSON Data into SQL Server?
Stratified Sampling in Pandas
How to pass data into table from a form using React Components
SQL Query to Convert Datetime to Date
How to Install PIP on Windows ?
How to Find the Wi-Fi Password Using CMD in Windows?
How to install Jupyter Notebook on Windows?
How to Align Text in HTML?
How to filter object array based on attributes?
How to update after aggregate in MongoDB?

To update documents, you cannot use aggregation pipeline. You can use update(). Let us first create a collection with documents −
> db.demo376.insertOne(
...    {
...
...       "id" :101,
...
...       "details" : [
...          {
...             Name:"Chris",
...             Age:21,
...             Score:45
...          },
...          {
...             Name:"David",
...             Age:23,
...             Score:67
...          },
...          {
...             Name:"Bob",
...             Age:20,
...             Score:54
...          }
...       ]
...    }
... )
{
   "acknowledged" : true,
   "insertedId" : ObjectId("5e5a71b92ae06a1609a00b0d")
}
Display all documents from a collection with the help of find() method −
> db.demo376.find().pretty();
This will produce the following output −
{
   "_id" : ObjectId("5e5a71b92ae06a1609a00b0d"),
   "id" : 101,
   "details" : [
      {
         "Name" : "Chris",
         "Age" : 21,
         "Score" : 45
      },
      {
         "Name" : "David",
         "Age" : 23,
         "Score" : 67
      },
      {
         "Name" : "Bob",
         "Age" : 20,
         "Score" : 54
      }
   ]
}
Following is the query to update −
> db.demo376.update(
...    {"id" :101},
...    {$inc:{"details.$[d].Age":3}},
...    {arrayFilters: [ {$and:[{"d.Age": 21},{"d.Score": {"$gt":40}} ]}] }
... )
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
Display all documents from a collection with the help of find() method −
> db.demo376.find().pretty();
This will produce the following output −
{
   "_id" : ObjectId("5e5a71b92ae06a1609a00b0d"),
   "id" : 101,
   "details" : [
      {
         "Name" : "Chris",
         "Age" : 24,
         "Score" : 45
      },
      {
         "Name" : "David",
         "Age" : 23,
         "Score" : 67
      },
      {
         "Name" : "Bob",
         "Age" : 20,
         "Score" : 54
      }
   ]
}
Python | How to copy a nested list - GeeksforGeeks

10 Apr, 2019
In the previous article, we have seen how to clone or Copy a list, now let’s see how to copy a nested list in Python.
Method #1: Using Iteration
# Python program to copy a nested list  # List initializationInput_list = [[0, 1, 2], [3, 4, 5], ]Output = []   # Using iteration to assign valuesfor x in range(len(Input_list)):    temp = []    for elem in Input_list[x]:        temp.append(elem)    Output.append(temp)  # Printing Outputprint("Initial list is:")print(Input_list)print("New assigned list is")print(Output)
Initial list is:
[[0, 1, 2], [3, 4, 5]]
New assigned list is
[[0, 1, 2], [3, 4, 5]]

 Method #2: Using deepcopy
# Python program to copy a nested listimport copy  # List initializationInput = [[1, 0, 1], [1, 0, 1]]  # using deepcopyOutput = copy.deepcopy(Input)  # Printingprint("Initial list is:")print(Input)print("New assigned list is")print(Output)
Initial list is:
[[1, 0, 1], [1, 0, 1]]
New assigned list is
[[1, 0, 1], [1, 0, 1]]

 Method #3: Using list comprehension and slicing
# Python program to copy a nested list  # List initializationInput_list = [[0,1,2], [3,4,5], [0, 1, 8]]  # comprehensive methodout_list = [ele[:] for ele in Input_list]  # Printing Outputprint("Initial list is:")print(Input_list)print("New assigned list is")print(out_list)
Initial list is:
[[0, 1, 2], [3, 4, 5], [0, 1, 8]]
New assigned list is
[[0, 1, 2], [3, 4, 5], [0, 1, 8]]

Python list-programs
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?
How to drop one or multiple columns in Pandas Dataframe
Python Classes and Objects
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?
C library function - fgetc()

The C library function int fgetc(FILE *stream) gets the next character (an unsigned char) from the specified stream and advances the position indicator for the stream.
Following is the declaration for fgetc() function.
int fgetc(FILE *stream)
stream − This is the pointer to a FILE object that identifies the stream on which the operation is to be performed.
stream − This is the pointer to a FILE object that identifies the stream on which the operation is to be performed.
This function returns the character read as an unsigned char cast to an int or EOF on end of file or error.
The following example shows the usage of fgetc() function.
#include <stdio.h>

int main () {
   FILE *fp;
   int c;
   int n = 0;
  
   fp = fopen("file.txt","r");
   if(fp == NULL) {
      perror("Error in opening file");
      return(-1);
   } do {
      c = fgetc(fp);
      if( feof(fp) ) {
         break ;
      }
      printf("%c", c);
   } while(1);

   fclose(fp);
   return(0);
}
Let us assume, we have a text file file.txt, which has the following content. This file will be used as an input for our example program −
We are in 2012
Now, let us compile and run the above program that will produce the following result −
We are in 2012


    12 Lectures 
     2 hours 

 Nishant Malik

    12 Lectures 
     2.5 hours 

 Nishant Malik

    48 Lectures 
     6.5 hours 

 Asif Hussain

    12 Lectures 
     2 hours 

 Richa Maheshwari

    20 Lectures 
     3.5 hours 

 Vandana Annavaram

    44 Lectures 
     1 hours 

 Amit Diwan
 Print
 Add Notes
 Bookmark this page
C library function - floor()

The C library function double floor(double x) returns the largest integer value less than or equal to x.
Following is the declaration for floor() function.
double floor(double x)
x − This is the floating point value.
x − This is the floating point value.
This function returns the largest integral value not greater than x.
The following example shows the usage of floor() function.
#include <stdio.h>
#include <math.h>

int main () {
   float val1, val2, val3, val4;

   val1 = 1.6;
   val2 = 1.2;
   val3 = 2.8;
   val4 = 2.3;

   printf("Value1 = %.1lf\n", floor(val1));
   printf("Value2 = %.1lf\n", floor(val2));
   printf("Value3 = %.1lf\n", floor(val3));
   printf("Value4 = %.1lf\n", floor(val4));
   
   return(0);
}
Let us compile and run the above program that will produce the following result −
Value1 = 1.0
Value2 = 1.0
Value3 = 2.0
Value4 = 2.0


    12 Lectures 
     2 hours 

 Nishant Malik

    12 Lectures 
     2.5 hours 

 Nishant Malik

    48 Lectures 
     6.5 hours 

 Asif Hussain

    12 Lectures 
     2 hours 

 Richa Maheshwari

    20 Lectures 
     3.5 hours 

 Vandana Annavaram

    44 Lectures 
     1 hours 

 Amit Diwan
 Print
 Add Notes
 Bookmark this page
MySQL DATE_ADD() to increment a date based on the value in another column?

Let us first create a table with one of the columns as DueDate and another one “RepeatTime, which displays how many times, let’s say a user was reminded to submit the payment −
mysql> create table DemoTable
   -> (
   -> DueDate date,
   -> RepeatTime int
   -> );
Query OK, 0 rows affected (0.57 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('2019-01-23',3);
Query OK, 1 row affected (0.13 sec)

mysql> insert into DemoTable values('2019-06-22',6);
Query OK, 1 row affected (0.19 sec)

mysql> insert into DemoTable values('2019-03-28',2);
Query OK, 1 row affected (0.25 sec)

mysql> insert into DemoTable values('2017-07-25',6);
Query OK, 1 row affected (0.15 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------------+------------+
| DueDate    | RepeatTime |
+------------+------------+
| 2019-01-23 |          3 |
| 2019-06-22 |          6 |
| 2019-03-28 |          2 |
| 2017-07-25 |          6 |
+------------+------------+
4 rows in set (0.00 sec)
Here is the query that increments date based in the values in another column −
mysql> update DemoTable set DueDate=date_add(DueDate,interval RepeatTime MONTH)
where RepeatTime!=6;
Query OK, 2 rows affected (0.25 sec)
Rows matched: 2 Changed: 2 Warnings: 0
Let us check table records once again −
mysql> select *from DemoTable;
This will produce the following output −
+------------+------------+
| DueDate    | RepeatTime |
+------------+------------+
| 2019-04-23 | 3          |
| 2019-06-22 | 6          |
| 2019-05-28 | 2          |
| 2017-07-25 | 6          |
+------------+------------+
4 rows in set (0.00 sec)
GATE | GATE-CS-2004 | Question 73 - GeeksforGeeks

28 Jun, 2021
The inclusion of which of the following sets into
S = {{1, 2}, {1, 2, 3}, {1, 3, 5}, (1, 2, 4), (1, 2, 3, 4, 5}}
is necessary and sufficient to make S a complete lattice under the partial order defined by set containment ?(A) {1}(B) {1}, {2, 3}(C) {1}, {1, 3}(D) {1}, {1, 3}, (1, 2, 3, 4}, {1, 2, 3, 5)Answer: (A)Explanation:
A partially ordered set L is called a complete lattice if every subset M of L has a least upper bound called as supremum and a greatest lower bound called as infimum.
We are given a set containment relation.
So, supremum element is union of all the subset and infimum element is intersection of all the subset.
Set S is not complete lattice because although it has a supremum for every subset, but some subsets have no infimum.We take subset {{1,3,5},{1,2,4}}.Intersection of these sets is {1}, which is not present in S.So we have to add set {1} in S to make it a complete lattice
Thus, option (A) is correct.Please comment below if you find anything wrong in the above post.Quiz of this Question
GATE-CS-2004
GATE-GATE-CS-2004
GATE
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
GATE | GATE-CS-2016 (Set 2) | Question 48
GATE | GATE-CS-2014-(Set-1) | Question 30
GATE | GATE-CS-2001 | Question 23
GATE | GATE-CS-2015 (Set 1) | Question 65
GATE | GATE CS 2010 | Question 45
GATE | GATE-CS-2015 (Set 3) | Question 65
GATE | GATE-CS-2014-(Set-1) | Question 65
GATE | GATE-CS-2015 (Set 1) | Question 42
C++ Program to count Vowels in a string using Pointer
GATE | GATE-CS-2004 | Question 3
Find n highest values in an object JavaScript

Let’s say, we have an object that describes various qualities of a football player like this −
const qualities = {
   defence: 82,
   attack: 92,
   heading: 91,
   pace: 96,
   dribbling: 88,
   tenacity: 97,
   vision: 91,
   passing: 95,
   shooting: 90
};
We wish to write a function that takes in such object and a number n (n <= no. of keys in object)
and returns an object with n highest key value pairs.
Like for n = 2
Output should be −
{
   tenacity: 97,
   pace: 96
}
Therefore, let’s write the code for this function,
The complete code for this function will be −
const qualities = {
   defence: 82,
   attack: 92,
   heading: 91,
   pace: 96,
   dribbling: 88,
   tenacity: 97,
   vision: 91,
   passing: 95,
   shooting: 90
};
const pickHighest = (obj, num = 1) => {
   const requiredObj = {};
   if(num > Object.keys(obj).length){
      return false;
   };
   Object.keys(obj).sort((a, b) => obj[b] - obj[a]).forEach((key, ind) =>
   {
      if(ind < num){
         requiredObj[key] = obj[key];
      }
   });
   return requiredObj;
};
console.log(pickHighest(qualities, 3));
The output in the console will be −
{ tenacity: 97, pace: 96, passing: 95 }
{ tenacity: 97 }
{ tenacity: 97, pace: 96, passing: 95, attack: 92, heading: 91 }
Difference between Sequence Diagram and Activity Diagram

06 Mar, 2019
What is Sequence Diagram ?
A sequence diagram simply depicts interaction between objects in a sequential order i.e. the order in which these interactions take place. We can also use the terms event diagrams or event scenarios to refer to a sequence diagram. Sequence diagrams describe how and in what order the objects in a system function. These diagrams are widely used by businessmen and software developers to document and understand requirements for new and existing systems.
Example: A sequence diagram for an emotion based music player:
What is Activity Diagram ?
An Activity Diagram is basically a flowchart (Unified Modelling Language) diagram which is used to describe the dynamic aspect of the system. the flowchart represents the flow of activities from one activity to another activity. The activities can be described as the operation of a System. The flow of control in the activity diagram is drawn from one operation to another. This flow can be sequential, branched or concurrent.
Example: An activity diagram for an emotion based music player
Similarities Between Sequence and Activity Diagram:
Both Sequence Diagram and Activity Diagram are UML diagrams.
Both Sequence and Activity Diagrams are used to represent the control flow of messages.
Differences Between Sequence Diagram and Activity Diagram
UML
Design Pattern
UML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Factory method design pattern in Java
Builder Design Pattern
MVC Design Pattern
Adapter Pattern
Introduction of Programming Paradigms
How to prevent Singleton Pattern from Reflection, Serialization and Cloning?
Abstract Factory Pattern
Monolithic vs Microservices architecture
Observer Pattern | Set 1 (Introduction)
Composite Design Pattern
numpy.rint() in Python

04 Dec, 2020
The numpy.rint() is a mathematical function that rounds elements of the array to the nearest integer.
Syntax : numpy.rint(x[, out]) = ufunc ‘rint’)Parameters :array : [array_like] Input array.
Return : An array with all array elements being rounded off, having same type and shape as input.
 Code #1 : Working
# Python program explaining# rint() functionimport numpy as np  in_array = [.5, 1.5, 2.5, 3.5, 4.5, 10.1]print ("Input array : \n", in_array)  rintoff_values = np.rint(in_array)print ("\nRounded values : \n", rintoff_values)    in_array = [.53, 1.54, .71]print ("\nInput array : \n", in_array)  rintoff_values = np.rint(in_array)print ("\nRounded values : \n", rintoff_values)  in_array = [.5538, 1.33354, .71445]print ("\nInput array : \n", in_array)  rintoff_values = np.rint(in_array)print ("\nRounded values : \n", rintoff_values)
Input array : 
 [0.5, 1.5, 2.5, 3.5, 4.5, 10.1]

Rounded values : 
 [  0.   2.   2.   4.   4.  10.]

Input array : 
 [0.53, 1.54, 0.71]

Rounded values : 
 [ 1.  2.  1.]

Input array : 
 [0.5538, 1.33354, 0.71445]

Rounded values : 
 [ 1.  1.  1.]

 
Code #2 : Working
# Python program explaining# rint() functionimport numpy as np  in_array = [1 ,4, 7, 9, 12]print ("Input array : \n", in_array)  rintoff_values = np.rint(in_array)print ("\nRounded values : \n", rintoff_values)  in_array = [133 ,344, 437, 449, 12]print ("\nInput array : \n", in_array)  rintoff_values = np.rint(in_array)print ("\nRounded values upto 2: \n", rintoff_values)  in_array = [133 ,344, 437, 449, 12]print ("\nInput array : \n", in_array)  rintoff_values = np.rint(in_array)print ("\nRounded values upto 3: \n", rintoff_values)
Input array : 
 [1, 4, 7, 9, 12]

Rounded values : 
 [  1.   4.   7.   9.  12.]

Input array : 
 [133, 344, 437, 449, 12]

Rounded values upto 2: 
 [ 133.  344.  437.  449.   12.]

Input array : 
 [133, 344, 437, 449, 12]

Rounded values upto 3: 
 [ 133.  344.  437.  449.   12.]

 References : https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.rint.html#numpy.rint.
Python numpy-Mathematical Function
Python-numpy
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Read a file line by line in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Iterate over a list in Python
Python OOPs Concepts
How to disable/ enable checkbox with jQuery?

fTo disable and enable checkbox, use the attr() method.
Initially set the input type checkbox and disable it −
<input type="checkbox" id="sName" name= "Male" style="width: 25px" value="male" disabled="disabled"/>Male
Now on the click of a button, toggle between disabled and enabled checkbox −
$("#button1").click(function() {
   $("#sName").attr('disabled', !$("#sName").attr('disabled'));
});
 Live Demo
<html>
<head>
<title>jQuery Example</title>
   <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
   <script>
      $(document).ready(function() {
         $("#button1").click(function() {
            $("#sName").attr('disabled', !$("#sName").attr('disabled'));
         });
      });
   </script>
</head>

<body>
<input type="checkbox" id="sName" name= "Male" style="width: 25px" value="male" disabled="disabled"/>Male
<br>
<br>
<input type="button" id="button1" value="Disable/ Enable" />
</body>
</html>
How to change axes limits in Seaborn?

14 Sep, 2021
Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. There are two methods available in the Axes module to change the limits:
matplotlib.axes.Axes.set_xlim(): Axes module of matplotlib library is used to set the x-axis view limits.matplotlib.axes.Axes.set_ylim(): Axes module of matplotlib library is used to set the y-axis view limits.
matplotlib.axes.Axes.set_xlim(): Axes module of matplotlib library is used to set the x-axis view limits.
matplotlib.axes.Axes.set_ylim(): Axes module of matplotlib library is used to set the y-axis view limits.
Syntax:
Axes.set_xlim(self, left=None, right=None, emit=True, auto=False, *, xmin=None, xmax=None)
Axes.set_ylim(self, bottom=None, top=None, emit=True, auto=False, *, ymin=None, ymax=None)
Parameters:
bottom: This parameter is the bottom xlim/ylim in data coordinates
top: This parameter is the top xlim/ylim in data coordinates
emit: This parameter is used to notify observers of limit change.
auto: This parameter is used to turn on autoscaling of the x-axis/y-axis.
xmin,xmax,ymin, ymax: These parametersthe are equivalent to bottom and top and it is an error to pass both xmin/ymin and bottom or xmax/ymax and top.
Returns:-
   bottom, top: This returns the new x-axis/y-axis limits in data coordinates.
Example 1:
Python3
# Import moduleimport matplotlib.pyplot as pltimport seaborn as sns # assign datadata = [3, 7, 9, 11, 12, 14,        15, 16, 18, 19, 20,        23, 25, 28] # depict visualizationfig, ax = plt.subplots()sns.distplot(data, ax=ax)ax.set_xlim(1, 70)plt.show()
Output:
Example 2:
Python3
# import moduleimport seaborn as snssns.set_style("whitegrid") # assign datasettips = sns.load_dataset("tips") # depict visualizationgfg = sns.boxplot(x="day", y="total_bill",                  data=tips)gfg.set_ylim(0, 80)
Output:
sagartomar9927
Picked
Python-Seaborn
Python
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Python Dictionary
Different ways to create Pandas Dataframe
Enumerate() in Python
Python String | replace()
How to Install PIP on Windows ?
*args and **kwargs in Python
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
Convert integer to string in Python
Python3 Program to Find Lexicographically minimum string rotation | Set 1

27 Dec, 2021
Write code to find lexicographic minimum in a circular array, e.g. for the array BCABDADAB, the lexicographic minimum is ABBCABDAD.Source: Google Written TestMore Examples: 
Input:  GEEKSQUIZ
Output: EEKSQUIZG

Input:  GFG
Output: FGG

Input:  GEEKSFORGEEKS
Output: EEKSFORGEEKSG
Following is a simple solution. Let the given string be ‘str’ 1) Concatenate ‘str’ with itself and store in a temporary string say ‘concat’. 2) Create an array of strings to store all rotations of ‘str’. Let the array be ‘arr’. 3) Find all rotations of ‘str’ by taking substrings of ‘concat’ at index 0, 1, 2..n-1. Store these rotations in arr[] 4) Sort arr[] and return arr[0].
Following is the implementation of above solution. 
Python3
# A simple Python3 program to find lexicographically # minimum rotation of a given string  # This function return lexicographically minimum# rotation of strdef minLexRotation(str_) :      # Find length of given string    n = len(str_)      # Create an array of strings to store all rotations    arr = [0] * n      # Create a concatenation of string with itself    concat = str_ + str_      # One by one store all rotations of str in array.    # A rotation is obtained by getting a substring of concat    for i in range(n) :        arr[i] = concat[i : n + i]      # Sort all rotations    arr.sort()      # Return the first rotation from the sorted array    return arr[0]  # Driver Codeprint(minLexRotation("GEEKSFORGEEKS"))print(minLexRotation("GEEKSQUIZ"))print(minLexRotation("BCABDADAB"))  # This code is contributed by divyamohan123
Output: 
EEKSFORGEEKSG
EEKSQUIZG
ABBCABDAD
Time complexity of the above solution is O(n2Logn) under the assumption that we have used a O(nLogn) sorting algorithm. Please refer complete article on Lexicographically minimum string rotation | Set 1 for more details!
lexicographic-ordering
rotation
Python
Strings
Strings
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Write a program to reverse an array or string
Reverse a string in Java
Write a program to print all permutations of a given string
C++ Data Types
Check for Balanced Brackets in an expression (well-formedness) using Stack
How to merge table cells in HTML?

To merge cells in HTML, use the colspan and rowspan attribute. The rowspan attribute is for the number of rows a cell should span, whereas the colspan attribute is for a number of columns a cell should span.
Both the attribute will be inside the <td> tag. The number will be a numeric value, for example, 2 for 2 rows if rowspan, 2 for 2 columns if column span.
Firstly, we will see how to create a table in HTML with 3 rows and 3 columns
<!DOCTYPE html>
<html>
   <head>
      <style>
         table, th, td {
            border: 1px solid black;
            width: 100px;
            height: 50px;
         }
      </style>
   </head>

   <body>
      <h1>Heading</h1>
      <table>
         <tr>
            <th></th>
            <th></th>
            <th></th>
         </tr>
         <tr>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
           <td></td>
           <td></td>
           <td></td>
         </tr>
      </table>
   </body>
</html>
Let’s merge cells using the colspan and rowspan attribute
<!DOCTYPE html>
<html>
   <head>
      <style>
         table, th, td {
            border: 1px solid black;
            width: 100px;
            height: 50px;
         }
      </style>
   </head>

   <body>
      <h1>Heading</h1>
      <table>
         <tr>
            <th colspan="2"></th>
            <th></th>
         </tr>
         <tr>
            <td></td>
            <td></td>
            <td rowspan="2"></td>
         </tr>
         <tr>
            <td></td>
            <td></td>
         </tr>
      </table>
   </body>
</html>
Java Program to Interchange Any Two Columns in the Matrix

07 Dec, 2021
Given a matrix having m rows and n columns. We have to write a Java program to interchange any two Columns(ie column no K and L given in the input) in the given matrix. Swap Operation is required to interchange the elements of two columns. O(1) operation to swap two columns is impossible because complete traversal between two columns is required.
Input 1: K = 1, L = 2,
        mat[][] = {{2, 1, 4},
                   {1, 2, 3},  
                   {3, 6, 2}}
                 
Output: mat[][] = {{1,2, 4},
                   {2,1, 3},  
                   {6,3, 2}}
                         
Input 2: K = 1, L = 1,
             mat[][] = {{2, 1, 4},
                        {1, 2, 3}}
                         
Output: mat[][] = {{2, 1, 4},
                   {1, 2, 3}}
                          
Input 3: K = 1, L = 3,
              mat[][] = {{2, 1,8},
                         {1, 2,9},  
                         {3, 6,5}}   
                              
Output:    {{8, 1,2},
            {9, 2,1},  
            {5, 6,3}}                        
If K and L ie column number that we have to interchange are the same, then print the matrix as it is.
Else Loop over the Kth and Lth column of the matrix.
Swap the elements of ith the index of both the columns while doing traversal.
Now after the loop gets over, print the matrix.
Below is the code implementation for the above approach:
Java
// Java program to interchange// two Column in a Matriximport java.io.*;class GFG {     public static void printMatrix(int[][] matrix)    {        for (int i = 0; i < matrix.length; i++) {            for (int j = 0; j < matrix[0].length; j++)                System.out.print(matrix[i][j] + " ");            System.out.println();        }    }    public static void exchangeAnyTwoColumns(int[][] matrix,                                             int K, int L)    {        for (int i = 0; i < matrix.length; i++) {             // Swap two numbers            int temp = matrix[i][K - 1];            matrix[i][K - 1] = matrix[i][L - 1];            matrix[i][L - 1] = temp;        }         // Print matrix        printMatrix(matrix);    }     public static void main(String[] args)    {        int K = 1, L = 2;        int mat[][]            = { { 2, 1, 4 }, { 1, 2, 3 }, { 3, 6, 2 } };         // calling the exchange Column function        exchangeAnyTwoColumns(mat, K, L);    }}
1 2 4 
2 1 3 
6 3 2 
Time Complexity: 0(n), Where n is the length of the Column.
Space Complexity: 0(1)
sweetyty
Picked
Java
Java Programs
Java
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Stream In Java
Introduction to Java
Constructors in Java
Exceptions in Java
Generics in Java
Java Programming Examples
Convert Double to Integer in Java
Implementing a Linked List in Java using Class
Factory method design pattern in Java
Java Program to Remove Duplicate Elements From the Array
Installing Helm & Kubernetes in Docker

14 Jun, 2021
Helm is simply a package manager for Kubernetes. It helps you manage Kubernetes applications — Helm Charts helps you define, install, and upgrade even the most complex Kubernetes application.
Follow the below steps to install Helm and Kubernetes in Docker:
Step 1: Installing Docker
First, download the Docker.exe from the official site ( Click this link to directly download docker for the win64 version )
Install the docker.exe file on your desktop.
Installing Docker Desktop
After installation is complete, restart your desktop.
Installation Complete
Step 2: Enabling Kubernetes in Docker Application
Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications. If you don’t understand Kubernetes, visit this article, it contains a basic introduction to Kubernetes. If you want to install Kubernetes, just follow the simple steps:
Open Docker Application.
Click Settings -> Kubernetes  -> Enable Kubernetes
Step 3: Adding Helm package for Kubernetes:
There are two ways by which you can add Helm package:
First, ensure that you are using an administrative shell.
Run Set-ExecutionPolicy Bypass -Scope Process on your command to check the execution policy
Now to download choco on your system, copy the following code and paste it on your command shell-
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
This may differ from your command shell, but the process is same. 
Now install helm from chocolatey, go to Command Shell or more commonly known as PowerShell and type:
choco install kubernetes-helm
Windows PowerShell running choco install kubernetes-helm
The easiest way is to just copy the following code and paste it on your command shell :- 
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh
LocalHost prompt window after running the code
docker
Advanced Computer Subject
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
React ES6 Array Methods

There are many JavaScript array methods.
One of the most useful in React is the .map() array method.
The .map() method allows you to run a function on each item in the array,
returning a new array as the result.
In React, map() can be used to generate lists.
Generate a list of items from an array:
const myArray = ['apple', 'banana', 'orange'];

const myList = myArray.map((item) => <p>{item}</p>)


Run Example »

Complete the array method that will allow you to run a function on each item in the array and return a new array.
const myList = myArray.((item) => <p>{item}</p>)

Start the Exercise
We just launchedW3Schools videos
Get certifiedby completinga course today!
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com
Your message has been sent to W3Schools.
Bool.parse method in C#

To convert a string to a bool, use the Bool.parse method in C# −
Firstly, set a string −
string str = "true";
Now, convert it to bool −
bool.Parse(str);
Here is the complete code −
 Live Demo
using System;
using System.Linq;
class Demo {
   static void Main() {
      string str = "true";
      bool res = bool.Parse(str);
      Console.WriteLine(res);
   }
}
True
PyQt - QFormLayout Class

QFormLayout is a convenient way to create two column form, where each row consists of an input field associated with a label. As a convention, the left column contains the label and the right column contains an input field. Mainly three overloads of addRow() method addLayout() are commonly used.
addRow(QLabel, QWidget)
Adds a row containing label and input field
addRow(QLabel, QLayout)
Adds a child layout in the second column
addRow(QWidget)
Adds a widget spanning both columns
This code adds a LineEdit field to input name in the first row. Then it adds a vertical box layout for two address fields in the second column of the next row. Next, a horizontal box layout object containing two Radio button fields is added in the second column of the third row. The fourth row shows two buttons ‘Submit’ and ‘Cancel’.
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *

def window():
   app = QApplication(sys.argv)
   win = QWidget()

   l1 = QLabel("Name")
   nm = QLineEdit()

   l2 = QLabel("Address")
   add1 = QLineEdit()
   add2 = QLineEdit()
   fbox = QFormLayout()
   fbox.addRow(l1,nm)
   vbox = QVBoxLayout()

   vbox.addWidget(add1)
   vbox.addWidget(add2)
   fbox.addRow(l2,vbox)
   hbox = QHBoxLayout()

   r1 = QRadioButton("Male")
   r2 = QRadioButton("Female")
   hbox.addWidget(r1)
   hbox.addWidget(r2)
   hbox.addStretch()
   fbox.addRow(QLabel("sex"),hbox)
   fbox.addRow(QPushButton("Submit"),QPushButton("Cancel"))

   win.setLayout(fbox)
   
   win.setWindowTitle("PyQt")
   win.show()
   sys.exit(app.exec_())

if __name__ == '__main__':
   window()
The above code produces the following output −

    146 Lectures 
     22.5 hours 

 ALAA EID
 Print
 Add Notes
 Bookmark this page
How to underline a text in HTML?

To underline a text in HTML, use the <u> tag. The <u> tag deprecated in HTML, but then re-introduced in HTML5. Now it represents a text different from another text stylistically, such as a misspelled word.
To underline a text, you can also use the style attribute. The style attribute specifies an inline style for an element. The attribute can be used with the HTML <p> tag, with the CSS property text-decoration.
Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.
You can try the following code to underline text in an HTML page, using the <u> tag
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>HTML u tag</title>
   </head>

   <body>
      <h1>Heading</h1>
      <p><u>This text will be underlined.</u></p>
   </body>
</html>
You can try the following code to underline text in an HTML page, using the CSS text-decoration property
Live Demo
<!DOCTYPE html>
<html>
   <head>
      <title>HTML Text underline</title>
   </head>

   <body>
      <h1>Heading</h1>
      <p style="text-decoration: underline;">This text will be underlined.</p>
   </body>
</html>
LESS - Comments

Comments make the code clear and understandable for the users. You can use both the block style and the inline comments in the code, but when you compile the LESS code, the single line comments will not appear in the CSS file.
The following example demonstrates the use of comments in the LESS file −
<html>
   <head>
      <title>Less Comments</title>
      <link rel = "stylesheet" type = "text/css" href = "style.css" />
   </head>

   <body>
      <h1>Example using Comments</h1>
      <p class = "myclass">LESS enables customizable, 
      manageable and reusable style sheet for web site.</p>
      <p class = "myclass1">It allows reusing CSS code and 
      writing LESS code with same semantics.</p>
   </body>
</html>
Now create the style.less file.
/* It displays the
green color! */
.myclass {
   color: green;
}

// It displays the blue color
.myclass1 {
   color: red;
}
You can compile the style.less file to style.css by using the following command −
lessc style.less style.css

Now execute the above command; it will create the style.css file automatically with the following code −
/* It displays the
green color! */
.myclass {
   color: green;
}

.myclass1 {
   color: red;
}
Follow these steps to see how the above code works −
Save the above html code in the comments.html file.
Save the above html code in the comments.html file.
Open this HTML file in a browser, the following output will get displayed.
Open this HTML file in a browser, the following output will get displayed.

    20 Lectures 
     1 hours 

 Anadi Sharma

    44 Lectures 
     7.5 hours 

 Eduonix Learning Solutions

    17 Lectures 
     2 hours 

 Zach Miller

    23 Lectures 
     1.5 hours 

 Zach Miller

    34 Lectures 
     4 hours 

 Syed Raza

    31 Lectures 
     3 hours 

 Harshit Srivastava
 Print
 Add Notes
 Bookmark this page
C Program to print “Even” or “Odd” without using Conditional statement

In this section we will see how to check whether a number is odd or even without using any kind of conditional statements like (<, <=, !=, >, >=, ==).
We can easily check the odd or even by using the conditional statements. We can divide the number by 2, then check whether the remainder is 0 or not. if 0, then it is even. Otherwise we can perform AND operation with the number and 1. If the answer is 0, then it is even, otherwise odd.
Here no conditional statements can be used. We will see two different methods to check the odd or even.
Here we will create an array of strings. The index 0 position will hold “Even”, and index 1 position will hold “Odd”. We can send the remainder after dividing the number by 2 as index to get the result directly.
#include<stdio.h>
main() {
   int n;
   char* arr[2] = {"Even", "Odd"};
   printf("Enter a number: "); //take the number from the user
   scanf("%d", &n);
   printf("The number is: %s", arr[n%2]); //get the remainder to choose
   the string
}
Enter a number: 40
The number is: Even
Enter a number: 89
The number is: Odd
This is the second method. In this method we will use some tricks. Here logical and bitwise operators are used. At first we are performing AND operation with the number and 1. Then using logical and to print the odd or even. When the result of bitwise AND is 1, then only the logical AND operation will return the odd result, otherwise it will return even.
#include<stdio.h>
main() {
   int n;
   char *arr[2] = {"Even", "Odd"};
   printf("Enter a number: "); //take the number from the user
   scanf("%d", &n);
   (n & 1 && printf("odd"))|| printf("even"); //n & 1 will be 1 when 1
   is present at LSb, so it is odd.
}
Enter a number: 40
even
Enter a number: 89
odd
How to add Google map inside html page without using API key ? - GeeksforGeeks

16 Apr, 2020
There are two ways to add google maps inside HTML page:
Using API keyWithout using API key
Using API key
Without using API key
To learn first case you can follow the article while to learn other one follow this article.
To insert google map inside the HTML page, follow the steps:
Go to the google maps and search your desired location.Now, you will see share option, click on it.Now, a dialog box will appear go to embed a map option.A new option will be seen inside the dialog box to copy html. And you can also select the size of the map you want to embed inside your page.Now paste it inside your html page.
Go to the google maps and search your desired location.
Now, you will see share option, click on it.
Now, a dialog box will appear go to embed a map option.
A new option will be seen inside the dialog box to copy html. And you can also select the size of the map you want to embed inside your page.
Now paste it inside your html page.
Example: How to add Google Map inside HTML page without using API key.
<!DOCTYPE html><html>  <head>    <meta charset="utf-8">    <title>Customize the scroll-bar</title>      <style media="screen">        body {            background-image: linear-gradient(                to right, dodgerblue, darkblue);        }    </style></head>  <body>    <center>        <h1 style="color:lawngreen;">            Geeks For Geeks        </h1>                  <div>            <!-- Google Map Copied Code -->            <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3506.2233913121413!2d77.4051603706222!3d28.50292593193056!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x390ce626851f7009%3A0x621185133cfd1ad1!2sGeeksforGeeks!5e0!3m2!1sen!2sin!4v1585040658255!5m2!1sen!2sin"                    width="400"                    height="300"                    frameborder="0"                    style="border:0;"                    allowfullscreen=""                    aria-hidden="false"                    tabindex="0">            </iframe>        </div>    </center></body>  </html>
Output:
Note: The issue of this technique is it doesn’t use API so map is not auto updated, so each time you have to manually update the map by changing the HTML code of map.
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.
HTML-Misc
HTML
Web Technologies
Web technologies Questions
HTML
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
How to Insert Form Data into Database using PHP ?
REST API (Introduction)
Form validation using HTML and JavaScript
Design a web page using HTML and CSS
How to create an HTML button that acts like a link?
Roadmap to Become a Web Developer in 2022
Installation of Node.js on Linux
How to fetch data from an API in ReactJS ?
Convert a string to an integer in JavaScript
Top 10 Angular Libraries For Web Developers
Number pattern in JavaScript

We are required to write a JavaScript and HTML program that provides the user with a text input and button. When the user enters any value in the input, say 5, and clicks the button, we should print the following pattern on the screen.
(for n = 5)
01
01 02
01 02 03
01 02 03 04
01 02 03 04 05
The code for this will be −
 Live Demo
<html>
<head>
<title>JavaScript Number Patterns</title>
<script type="text/javascript">
   const printPattern = () => {
      const num = document.getElementById("rows").value;
      for(let m=1; m <= num; m++){
         for(let n=1; n <= m; n++){
            document.write("0"+n+" ");
         }
         document.write("<br />");
      }
   }
</script>
</head>
<body>
<p>Enter the number of rows and press print</p>
<input type="number" placeholder="Number of Rows" id="rows">
<button type="button" onclick="printPattern()">Print</button>
</body>
</html>
And the output in the console will be −
Before entering values −
Final result −
bits.OnesCount() Function in Golang with Examples - GeeksforGeeks

19 Apr, 2020
Go language provides inbuilt support for bits to implement bit counting and manipulation functions for the predeclared unsigned integer types with the help of bits package. This package provides OnesCount() function which is used to find the number of one bits in a. To access the OnesCount() function you need to add a math/bits package in your program with the help of the import keyword.
Syntax:
func OnesCount(a uint) int
Parameters: This function takes one parameter of uint type, i.e., a.Return Value: This function returns the total number of one bits that are used to represent a.
Example 1:
// Golang program to illustrate bits.OnesCount() Functionpackage main  import (    "fmt"    "math/bits")  // Main functionfunc main() {      // Using OnesCount() function    a := bits.OnesCount(3)    fmt.Printf("Total number of one bits "+     "that are used to represent %d: %d", 3, a)  }
Output:
Total number of one bits that are used to represent 3: 2
Example 2:
// Golang program to illustrate bits.OnesCount() Functionpackage main  import (    "fmt"    "math/bits")  // Main functionfunc main() {      // Using OnesCount() function    a1 := bits.OnesCount(5)    fmt.Printf("OnesCount(%b) = %d\n", 5, a1)      a2 := bits.OnesCount(12)    fmt.Printf("OnesCount(%b) = %d\n", 12, a2)  }
Output:
OnesCount(101) = 2
OnesCount(1100) = 2

Golang-bits
Go Language
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Time Durations in Golang
How to Parse JSON in Golang?
Structures in Golang
Strings in Golang
Defer Keyword in Golang
How to iterate over an Array using for loop in Golang?
Loops in Go Language
Class and Object in Golang
Rune in Golang
time.Parse() Function in Golang With Examples