title stringlengths 3 221 | text stringlengths 17 477k | parsed listlengths 0 3.17k |
|---|---|---|
Perfect Numbers | Practice | GeeksforGeeks | Given a number N, check if a number is perfect or not. A number is said to be perfect if sum of all its factors excluding the number itself is equal to the number.
Example 1:
Input:
N = 6
Output:
1
Explanation:
Factors of 6 are 1, 2, 3 and 6.
Excluding 6 their sum is 6 which
is equal to N itself. So, it's a
Perfect ... | [
{
"code": null,
"e": 402,
"s": 238,
"text": "Given a number N, check if a number is perfect or not. A number is said to be perfect if sum of all its factors excluding the number itself is equal to the number."
},
{
"code": null,
"e": 415,
"s": 404,
"text": "Example 1:"
},
{
... |
Find the element before which all the elements are smaller than it, and after which all are greater | 30 Jun, 2022
Given an array, find an element before which all elements are smaller than it, and after which all are greater than it. Return the index of the element if there is such an element, otherwise, return -1.
Examples:
Input: arr[] = {5, 1, 4, 3, 6, 8, 10, 7, 9}; Output: 4 Explanation: All elements on left of ar... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n30 Jun, 2022"
},
{
"code": null,
"e": 257,
"s": 54,
"text": "Given an array, find an element before which all elements are smaller than it, and after which all are greater than it. Return the index of the element if there is such an el... |
How to get the height of scroll bar using JavaScript ? | 31 Aug, 2020
Given an HTML document and the task is to get the height of the scrollbar using JavaScript. Following are the different approaches to solve this problem which are discussed below:
Approach 1: In this approach, a div element is created that contains a scrollbar. To get the height of the scroll bar the offse... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n31 Aug, 2020"
},
{
"code": null,
"e": 208,
"s": 28,
"text": "Given an HTML document and the task is to get the height of the scrollbar using JavaScript. Following are the different approaches to solve this problem which are discussed be... |
View DICOM images using pydicom and matplotlib | 24 Feb, 2021
Prerequisite : Matplotlib
DICOM stands for Digital Imaging and Communications in Medicine. DICOM files were introduced to maintain uniformity among varied types of medical image modalities. It is a standard format to view, store, share and retrieve medical images.
Python offers a powerful module, pydicom ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n24 Feb, 2021"
},
{
"code": null,
"e": 55,
"s": 28,
"text": "Prerequisite : Matplotlib "
},
{
"code": null,
"e": 294,
"s": 55,
"text": "DICOM stands for Digital Imaging and Communications in Medicine. DICOM files were... |
How To Pass and Parse Linux Bash Script Arguments and Parameters | 18 May, 2022
Parsing and Passing of Arguments into bash scripts/ shell scripts is quite similar to the way in which we pass arguments to the functions inside Bash scripts. We’ll see the actual process of passing on the arguments to a script and also look at the way to access those arguments inside the script.
We can pa... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n18 May, 2022"
},
{
"code": null,
"e": 352,
"s": 54,
"text": "Parsing and Passing of Arguments into bash scripts/ shell scripts is quite similar to the way in which we pass arguments to the functions inside Bash scripts. We’ll see the a... |
Get length of dictionary in Python | 14 Jan, 2020
Dictionaries in Python are a collection of key-value pairs of data. These are used in many manipulations in Python and are one of the most important data structures in python. To calculate the length of the dictionary, the built-in len() method is used.
This in-built method takes a Python object as an argu... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n14 Jan, 2020"
},
{
"code": null,
"e": 282,
"s": 28,
"text": "Dictionaries in Python are a collection of key-value pairs of data. These are used in many manipulations in Python and are one of the most important data structures in python.... |
Python program to remove Duplicates elements from a List? | One list is given with duplicate element, our task is create another list which contains the element of without duplicates.
A::[2,3,4,3,4,6,78,90]
Output::[2,3,4,6,78,90]
Step 1: create a list.
Step 2: create a new list which is empty.
Step 3: traverse every element in list.
Step 4: if element is not present in the li... | [
{
"code": null,
"e": 1311,
"s": 1187,
"text": "One list is given with duplicate element, our task is create another list which contains the element of without duplicates."
},
{
"code": null,
"e": 1359,
"s": 1311,
"text": "A::[2,3,4,3,4,6,78,90]\nOutput::[2,3,4,6,78,90]\n"
},
... |
Rename object key in JavaScript | 25 Jun, 2019
JavaScript doesn’t provide an inbuilt function to rename an object key. So we will look at different approaches to accomplish this in this article.
Keys:In JavaScript, objects are used to store collection of various data. It is a collection of properties. A property is a “key:value” pair. Keys are known as... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n25 Jun, 2019"
},
{
"code": null,
"e": 200,
"s": 52,
"text": "JavaScript doesn’t provide an inbuilt function to rename an object key. So we will look at different approaches to accomplish this in this article."
},
{
"code": null... |
Convert String to Set in Python | 20 Aug, 2020
We can convert a string to setin Python using the set() function.
Syntax : set(iterable)
Parameters : Any iterable sequence like list, tuple or dictionary.
Returns : An empty set if no element is passed. Non-repeating element iterable modified as passed as argument.
Example 1 :
# create a string strstring ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n20 Aug, 2020"
},
{
"code": null,
"e": 94,
"s": 28,
"text": "We can convert a string to setin Python using the set() function."
},
{
"code": null,
"e": 117,
"s": 94,
"text": "Syntax : set(iterable)"
},
{
"code... |
Largest subset whose all elements are Fibonacci numbers - GeeksforGeeks | 22 Mar, 2022
Given an array with positive number the task is that we find largest subset from array that contain elements which are Fibonacci numbers.Asked in Facebook Examples :
Input : arr[] = {1, 4, 3, 9, 10, 13, 7};
Output : subset[] = {1, 3, 13}
The output three numbers are Fibonacci
numbers.
Input : arr[] = {... | [
{
"code": null,
"e": 24443,
"s": 24415,
"text": "\n22 Mar, 2022"
},
{
"code": null,
"e": 24611,
"s": 24443,
"text": "Given an array with positive number the task is that we find largest subset from array that contain elements which are Fibonacci numbers.Asked in Facebook Examples... |
Two columns as primary key with auto-increment in MySQL? | Achieve this using MyISAM Engine. Here is an example of two columns as primary key with auto-increment.
Creating a table with two columns as primary key −
mysql> create table TwoPrimaryKeyTableDemo
-> (
-> Result ENUM('First','Second','Third','Fail') not null,
-> StudentId int not null auto_increment,
-> St... | [
{
"code": null,
"e": 1166,
"s": 1062,
"text": "Achieve this using MyISAM Engine. Here is an example of two columns as primary key with auto-increment."
},
{
"code": null,
"e": 1217,
"s": 1166,
"text": "Creating a table with two columns as primary key −"
},
{
"code": null,... |
MySQL - Cursor FETCH Statement | A cursor in database is a construct which allows you to iterate/traversal the records of a table. In MySQL you can use cursors with in a stored program such as procedures, functions etc.
In other words, you can iterate though the records of a table from a MySQL stored program using the cursors. The cursors provided by ... | [
{
"code": null,
"e": 2520,
"s": 2333,
"text": "A cursor in database is a construct which allows you to iterate/traversal the records of a table. In MySQL you can use cursors with in a stored program such as procedures, functions etc."
},
{
"code": null,
"e": 2692,
"s": 2520,
"tex... |
Histograms and Density Plots in R - GeeksforGeeks | 25 Feb, 2021
A histogram is a graphical representation that organizes a group of data points into user-specified ranges and an approximate representation of the distribution of numerical data.
In R language the histogram is built with the use of hist() function.
Syntax: hist(v,main,xlab,xlim,ylim,breaks,col,border)
Par... | [
{
"code": null,
"e": 24071,
"s": 24043,
"text": "\n25 Feb, 2021"
},
{
"code": null,
"e": 24251,
"s": 24071,
"text": "A histogram is a graphical representation that organizes a group of data points into user-specified ranges and an approximate representation of the distribution of... |
Count ways to express 'n' as sum of odd integers - GeeksforGeeks | 01 Apr, 2022
Given an positive integer n. Count total number of ways to express ‘n’ as sum of odd positive integers.
Input: 4
Output: 3
Explanation
There are only three ways to write 4
as sum of odd integers:
1. 1 + 3
2. 3 + 1
3. 1 + 1 + 1 + 1
Input: 5
Output: 5
Simple approach is to find recursive nature of prob... | [
{
"code": null,
"e": 25408,
"s": 25380,
"text": "\n01 Apr, 2022"
},
{
"code": null,
"e": 25514,
"s": 25408,
"text": "Given an positive integer n. Count total number of ways to express ‘n’ as sum of odd positive integers. "
},
{
"code": null,
"e": 25662,
"s": 2551... |
JavaScript - Convert an array to key value pair | Suppose we have an array like this −
const arr = [
{"name": "Rahul", "score": 89},
{"name": "Vivek", "score": 88},
{"name": "Rakesh", "score": 75},
{"name": "Sourav", "score": 82},
{"name": "Gautam", "score": 91},
{"name": "Sunil", "score": 79},
];
We are required to write a JavaScript function that take... | [
{
"code": null,
"e": 1099,
"s": 1062,
"text": "Suppose we have an array like this −"
},
{
"code": null,
"e": 1326,
"s": 1099,
"text": "const arr = [\n{\"name\": \"Rahul\", \"score\": 89},\n {\"name\": \"Vivek\", \"score\": 88},\n {\"name\": \"Rakesh\", \"score\": 75},\n {\"... |
Checking if a HashSet contains certain value in Java | Let’s say the following is our Integer array −
Integer arr[] = { 50, 100, 150, 200, 250, 300 };
Set the above integer array in HashSet −
Set<Integer>set = new HashSet<Integer>(Arrays.asList(arr));
Now, let us check whether the HashSet contains certain value or not −
set.contains(150)
TRUE is returned if the value is in... | [
{
"code": null,
"e": 1109,
"s": 1062,
"text": "Let’s say the following is our Integer array −"
},
{
"code": null,
"e": 1158,
"s": 1109,
"text": "Integer arr[] = { 50, 100, 150, 200, 250, 300 };"
},
{
"code": null,
"e": 1199,
"s": 1158,
"text": "Set the above i... |
Difference between BFS and DFS - GeeksforGeeks | 11 Apr, 2022
Breadth First Search:BFS stands for Breadth First Search is a vertex-based technique for finding the shortest path in the graph. It uses a Queue data structure that follows first in first out. In BFS, one vertex is selected at a time when it is visited and marked then its adjacent are visited and stored in... | [
{
"code": null,
"e": 24720,
"s": 24692,
"text": "\n11 Apr, 2022"
},
{
"code": null,
"e": 25071,
"s": 24720,
"text": "Breadth First Search:BFS stands for Breadth First Search is a vertex-based technique for finding the shortest path in the graph. It uses a Queue data structure tha... |
Possible paths between 2 vertices | Practice | GeeksforGeeks | Given a Directed Graph having V nodes numbered from 1 to V, and E directed edges. Given two nodes, source and destination, count the number of ways or paths between these two vertices in the directed graph. These paths should not contain any cycle.
Note: Graph doesn't contain multiple edges, self-loop, and cycles.
Exa... | [
{
"code": null,
"e": 554,
"s": 238,
"text": "Given a Directed Graph having V nodes numbered from 1 to V, and E directed edges. Given two nodes, source and destination, count the number of ways or paths between these two vertices in the directed graph. These paths should not contain any cycle.\nNote:... |
Difference between Turn Around Time (TAT) and Waiting Time (WT) in CPU Scheduling - GeeksforGeeks | 28 Mar, 2020
In CPU Scheduling, we often need to find average Turnaround and Waiting Time with the help of Arrival, Burst and Completion Time. Let’s have a brief look of them:
Turnaround Time (TAT):
It is the time interval from the time of submission of a process to the time of the completion of the process.Difference ... | [
{
"code": null,
"e": 24782,
"s": 24754,
"text": "\n28 Mar, 2020"
},
{
"code": null,
"e": 24945,
"s": 24782,
"text": "In CPU Scheduling, we often need to find average Turnaround and Waiting Time with the help of Arrival, Burst and Completion Time. Let’s have a brief look of them:"... |
How can we implement a splash screen using JWindow in Java?
| A JWindow is a container that can be displayed anywhere on the user desktop. It does not have the title bar, window management buttons, etc like a JFrame.
The JWindow contains a JRootPane as its only child class. The contentPane can be the parent of any children of the JWindow. Like a JFrame, a JWindow is another top-l... | [
{
"code": null,
"e": 1217,
"s": 1062,
"text": "A JWindow is a container that can be displayed anywhere on the user desktop. It does not have the title bar, window management buttons, etc like a JFrame."
},
{
"code": null,
"e": 1651,
"s": 1217,
"text": "The JWindow contains a JRoo... |
Find number of diagonals in n sided convex polygon | 22 Jun, 2022
Given n > 3, find number of diagonals in n sided convex polygon.According to Wikipedia, In geometry, a diagonal is a line segment joining two vertices of a polygon or polyhedron, when those vertices are not on the same edge. Informally, any sloping line is called diagonal.
Examples :
Input : 5
Output : 5
... | [
{
"code": null,
"e": 54,
"s": 26,
"text": "\n22 Jun, 2022"
},
{
"code": null,
"e": 328,
"s": 54,
"text": "Given n > 3, find number of diagonals in n sided convex polygon.According to Wikipedia, In geometry, a diagonal is a line segment joining two vertices of a polygon or polyhed... |
strtod() function in C/C++ | 21 Aug, 2018
The strtod() is a builtin function in C and C++ STL which interprets the contents of the string as a floating point number and return its value as a double.It sets a pointer to point to the first character after the last valid character of the string, only if there is any, otherwise it sets the pointer to ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n21 Aug, 2018"
},
{
"code": null,
"e": 341,
"s": 28,
"text": "The strtod() is a builtin function in C and C++ STL which interprets the contents of the string as a floating point number and return its value as a double.It sets a pointer t... |
How to round array elements to the given number of decimals using NumPy? | 05 Sep, 2020
In NumPy, we can round array elements to the given number of decimals with the help of round().
Syntax:
np.round(a, decimals=0, out=None)
The first parameter will be an array and the second parameter will be the number of decimals for which needed rounded. If no parameter will be pass as the second parame... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n05 Sep, 2020"
},
{
"code": null,
"e": 125,
"s": 28,
"text": "In NumPy, we can round array elements to the given number of decimals with the help of round(). "
},
{
"code": null,
"e": 133,
"s": 125,
"text": "Syntax:"
... |
Convert JSON to CSV in Python | 29 May, 2021
The full form of JSON is JavaScript Object Notation. It means that a script (executable) file which is made of text in a programming language, is used to store and transfer the data. Python supports JSON through a built-in package called JSON. To use this feature, we import the JSON package in Python scrip... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n29 May, 2021"
},
{
"code": null,
"e": 511,
"s": 52,
"text": "The full form of JSON is JavaScript Object Notation. It means that a script (executable) file which is made of text in a programming language, is used to store and transfer t... |
Closest ancestor element that has a specific class in JavaScript | 02 Jun, 2020
The task is to find the closest ancestor of the element of specific class with the help of pure Javascript. There are two approaches that are discussed below.
Approach 1: Use the Javascript selector to select the element. Use closest() method to get the closest parent with specific class.
Example: This ... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n02 Jun, 2020"
},
{
"code": null,
"e": 187,
"s": 28,
"text": "The task is to find the closest ancestor of the element of specific class with the help of pure Javascript. There are two approaches that are discussed below."
},
{
"c... |
Python Docstrings | 12 Aug, 2020
Python documentation strings (or docstrings) provide a convenient way of associating documentation with Python modules, functions, classes, and methods.
It’s specified in source code that is used, like a comment, to document a specific segment of code. Unlike conventional source code comments, the docstrin... | [
{
"code": null,
"e": 52,
"s": 24,
"text": "\n12 Aug, 2020"
},
{
"code": null,
"e": 205,
"s": 52,
"text": "Python documentation strings (or docstrings) provide a convenient way of associating documentation with Python modules, functions, classes, and methods."
},
{
"code":... |
Kotlin do-while loop | 20 May, 2019
Like Java, do-while loop is a control flow statement which executes a block of code at least once without checking the condition, and then repeatedly executes the block, or not, it totally depends upon a Boolean condition at the end of do-while block. It contrast with the while loop because while loop exec... | [
{
"code": null,
"e": 28,
"s": 0,
"text": "\n20 May, 2019"
},
{
"code": null,
"e": 481,
"s": 28,
"text": "Like Java, do-while loop is a control flow statement which executes a block of code at least once without checking the condition, and then repeatedly executes the block, or no... |
How to set a countdown timer in javascript? | You can create a countdown timer in Javascript using the setInterval
method. The setInterval() method, repeatedly calls a function or executes
a code snippet, with a fixed time delay between each call.
To create a countdown, we need to check the difference between current
time and final time and keep updating the count... | [
{
"code": null,
"e": 1264,
"s": 1062,
"text": "You can create a countdown timer in Javascript using the setInterval\nmethod. The setInterval() method, repeatedly calls a function or executes\na code snippet, with a fixed time delay between each call."
},
{
"code": null,
"e": 1401,
"s... |
Generate an array of given size with equal count and sum of odd and even numbers - GeeksforGeeks | 10 May, 2021
Given an integer N, the task is to find an array of length N that contains same count of odd and even elements with an equal sum of even and odd elements in the array.Note: Print -1 if no such array is possible. Examples:
Input: N = 4 Output: 1 2 5 4 Explanation: Even elements of the array – {2, 4}, S(ev... | [
{
"code": null,
"e": 24655,
"s": 24627,
"text": "\n10 May, 2021"
},
{
"code": null,
"e": 24879,
"s": 24655,
"text": "Given an integer N, the task is to find an array of length N that contains same count of odd and even elements with an equal sum of even and odd elements in the ar... |
Usage of -moz-opacity property with CSS | The -moz-opacity property of an image is used to set the opacity of an image. This property is used to create a transparent image in Mozilla. IE uses filter:alpha(opacity=x) to create transparent images.
You can try to run the following code to style an image and set opacity with CSS
<html>
<head>
</head>
<bod... | [
{
"code": null,
"e": 1266,
"s": 1062,
"text": "The -moz-opacity property of an image is used to set the opacity of an image. This property is used to create a transparent image in Mozilla. IE uses filter:alpha(opacity=x) to create transparent images."
},
{
"code": null,
"e": 1347,
"s... |
java.time.LocalTime.compareTo() Method Example | The java.time.LocalTime.compareTo(LocalTime other) method compares this time to another time.
Following is the declaration for java.time.LocalTime.compareTo(LocalTime other) method.
public int compareTo(LocalTime other)
other − the other time to compare to, not null.
the comparator value, negative if less, positive if... | [
{
"code": null,
"e": 2009,
"s": 1915,
"text": "The java.time.LocalTime.compareTo(LocalTime other) method compares this time to another time."
},
{
"code": null,
"e": 2097,
"s": 2009,
"text": "Following is the declaration for java.time.LocalTime.compareTo(LocalTime other) method."... |
C# | Remove all objects from the Stack - GeeksforGeeks | 07 Dec, 2018
Stack represents a last-in, first out collection of object. It is used when you need a last-in, first-out access to items. When you add an item in the list, it is called pushing the item and when you remove it, it is called popping the item. Stack<T>.Clear Method is used to Removes all objects from the Sta... | [
{
"code": null,
"e": 23911,
"s": 23883,
"text": "\n07 Dec, 2018"
},
{
"code": null,
"e": 24277,
"s": 23911,
"text": "Stack represents a last-in, first out collection of object. It is used when you need a last-in, first-out access to items. When you add an item in the list, it is ... |
Tryit Editor v3.7 | Tryit: The object element | [] |
How the Bellman equation works in Deep RL? | Towards Data Science | In the Bellman equation, the value function Φ(t) depends on the value function Φ(t+1). Despite this, the value of Φ(t) can be obtained before the state reaches time t+1. We can do this using neural networks, because they can approximate the function Φ(t) for any time t. We will see how it looks in Python. In the last t... | [
{
"code": null,
"e": 630,
"s": 172,
"text": "In the Bellman equation, the value function Φ(t) depends on the value function Φ(t+1). Despite this, the value of Φ(t) can be obtained before the state reaches time t+1. We can do this using neural networks, because they can approximate the function Φ(t) ... |
Right align a Bootstrap dropdown menu | Use the .dropdown-menu-right class in Bootstrap to right align a dropdown menu −
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 = "/bootst... | [
{
"code": null,
"e": 1143,
"s": 1062,
"text": "Use the .dropdown-menu-right class in Bootstrap to right align a dropdown menu −"
},
{
"code": null,
"e": 1153,
"s": 1143,
"text": "Live Demo"
},
{
"code": null,
"e": 2048,
"s": 1153,
"text": "<!DOCTYPE html>\n<ht... |
Company Valuation Using Probabilistic Models With Python | by Julian Marx | Towards Data Science | Note from Towards Data Science’s editors: While we allow independent authors to publish articles in accordance with our rules and guidelines, we do not endorse each author’s contribution. You should not rely on an author’s works without seeking professional advice. See our Reader Terms for details.
In a perfectly predi... | [
{
"code": null,
"e": 472,
"s": 172,
"text": "Note from Towards Data Science’s editors: While we allow independent authors to publish articles in accordance with our rules and guidelines, we do not endorse each author’s contribution. You should not rely on an author’s works without seeking profession... |
Take Matrix input from user in Python | In this tutorial, we are going to learn how to take matric input in Python from the user.
We can take input from the user in two different ways. Let's see two of them.
Taking all numbers of the matric one by one from the user. See the code below.
# initializing an empty matrix
matrix = []
# taking 2x2 matrix from the u... | [
{
"code": null,
"e": 1355,
"s": 1187,
"text": "In this tutorial, we are going to learn how to take matric input in Python from the user.\nWe can take input from the user in two different ways. Let's see two of them."
},
{
"code": null,
"e": 1434,
"s": 1355,
"text": "Taking all nu... |
AI - Popular Search Algorithms | Searching is the universal technique of problem solving in AI. There are some single-player games such as tile games, Sudoku, crossword, etc. The search algorithms help you to search for a particular position in such games.
The games such as 3X3 eight-tile, 4X4 fifteen-tile, and 5X5 twenty four tile puzzles are single-... | [
{
"code": null,
"e": 2113,
"s": 1889,
"text": "Searching is the universal technique of problem solving in AI. There are some single-player games such as tile games, Sudoku, crossword, etc. The search algorithms help you to search for a particular position in such games."
},
{
"code": null,
... |
How to build Plotly Choropleth Map with COVID data using Pandas in Google Colab | by Siddhartha Banerjee, PhD | Towards Data Science | Install packages and toolsImport the dataAnalyze the dataGraphically present the data in US choropleth map
Install packages and tools
Import the data
Analyze the data
Graphically present the data in US choropleth map
In Google Colab environment you can pip install packages required for your code. You need plotly-geo , ... | [
{
"code": null,
"e": 279,
"s": 172,
"text": "Install packages and toolsImport the dataAnalyze the dataGraphically present the data in US choropleth map"
},
{
"code": null,
"e": 306,
"s": 279,
"text": "Install packages and tools"
},
{
"code": null,
"e": 322,
"s": 3... |
Cumulative frequency of count of each element in an unsorted array - GeeksforGeeks | 15 Dec, 2021
Given an unsorted array. The task is to calculate the cumulative frequency of each element of the array using a count array.
Examples:
Input : arr[] = [1, 2, 2, 1, 3, 4]
Output :1->2
2->4
3->5
4->6
Input : arr[] = [1, 1, 1, 2, 2, 2]
Output :1->3
2->6
A simple solution is... | [
{
"code": null,
"e": 24429,
"s": 24401,
"text": "\n15 Dec, 2021"
},
{
"code": null,
"e": 24554,
"s": 24429,
"text": "Given an unsorted array. The task is to calculate the cumulative frequency of each element of the array using a count array."
},
{
"code": null,
"e": 2... |
MySQL: update field with Group By? | To update field with GROUP BY, use ORDER BY LIMIT with UPDATE command −
mysql> create table DemoTable2018
-> (
-> EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> EmployeeName varchar(20),
-> EmployeeSalary int
-> );
Query OK, 0 rows affected (0.61 sec)
Insert some records in the table using insert... | [
{
"code": null,
"e": 1134,
"s": 1062,
"text": "To update field with GROUP BY, use ORDER BY LIMIT with UPDATE command −"
},
{
"code": null,
"e": 1337,
"s": 1134,
"text": "mysql> create table DemoTable2018\n -> (\n -> EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY,\n -> E... |
How to debug machine learning models to catch issues early and often | by Shashank Prasanna | Towards Data Science | If you work in software development, you know that bugs are a fact of life. They’ll be there when you start your project, and they’ll be there when you ship your product to customers. Over the last couple of decades, the software development community has developed a number of tools, IDEs, libraries and techniques to h... | [
{
"code": null,
"e": 560,
"s": 171,
"text": "If you work in software development, you know that bugs are a fact of life. They’ll be there when you start your project, and they’ll be there when you ship your product to customers. Over the last couple of decades, the software development community has... |
PyGTK - Scrollbar Class | This class is an abstract base class for gtk.Hscrollbar and gtk.Vscrollbar widgets. Both are associated with an Adjustment object. The position of the thumb of the scrollbar is controlled by scroll adjustments. The attributes of adjustment object are used as follows −
The following program shows an HScale and an HScrol... | [
{
"code": null,
"e": 3003,
"s": 2734,
"text": "This class is an abstract base class for gtk.Hscrollbar and gtk.Vscrollbar widgets. Both are associated with an Adjustment object. The position of the thumb of the scrollbar is controlled by scroll adjustments. The attributes of adjustment object are us... |
How can I make a scatter plot colored by density in Matplotlib? | We can create a dict for color and a value. If the same value comes up, we can use a scatter method and if the closer values have the same set of colors, that could make the plot color denser.
Create a new figure, or activate an existing figure.
Create a new figure, or activate an existing figure.
Add an ~.axes.Axes to... | [
{
"code": null,
"e": 1255,
"s": 1062,
"text": "We can create a dict for color and a value. If the same value comes up, we can use a scatter method and if the closer values have the same set of colors, that could make the plot color denser."
},
{
"code": null,
"e": 1308,
"s": 1255,
... |
Python groupby method to remove all consecutive duplicates - GeeksforGeeks | 27 Dec, 2017
Given a string S, remove all the consecutive duplicates.
Examples:
Input : aaaaabbbbbb
Output : ab
Input : geeksforgeeks
Output : geksforgeks
Input : aabccba
Output : abcba
We have existing solution for this problem please refer Remove all consecutive duplicates from the string link. We can solve this ... | [
{
"code": null,
"e": 24476,
"s": 24448,
"text": "\n27 Dec, 2017"
},
{
"code": null,
"e": 24533,
"s": 24476,
"text": "Given a string S, remove all the consecutive duplicates."
},
{
"code": null,
"e": 24543,
"s": 24533,
"text": "Examples:"
},
{
"code": n... |
Can we declare a try catch block within another try catch block in Java? | Yes, we can declare a try-catch block within another try-catch block, this is called nested try-catch block.
If an inner try statement does not have a matching catch statement for a particular exception, the control is transferred to the next try statement catch handlers that are expected for a matching catch statement... | [
{
"code": null,
"e": 1171,
"s": 1062,
"text": "Yes, we can declare a try-catch block within another try-catch block, this is called nested try-catch block."
},
{
"code": null,
"e": 1384,
"s": 1171,
"text": "If an inner try statement does not have a matching catch statement for a ... |
Asymmetric Encryption Cryptography in Java - GeeksforGeeks | 14 Jul, 2021
Cryptography is the study of different techniques to secure data from an unauthorized entity. In computer science, we try to develop strategies and practices for protecting sensitive data. Most of the cryptography involves very advanced Mathematical functions used for securing data. The sole purpose of the... | [
{
"code": null,
"e": 24121,
"s": 24093,
"text": "\n14 Jul, 2021"
},
{
"code": null,
"e": 25060,
"s": 24121,
"text": "Cryptography is the study of different techniques to secure data from an unauthorized entity. In computer science, we try to develop strategies and practices for p... |
Tryit Editor v3.7 | Tryit: HTML round table borders | [] |
Explain C++ Singleton design pattern. | Singleton design pattern is a software design principle that is used to restrict the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system. For example, if you are using a logger, that writes logs to a file, you can use a singleton class to crea... | [
{
"code": null,
"e": 1460,
"s": 1062,
"text": "Singleton design pattern is a software design principle that is used to restrict the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system. For example, if you are using a logger... |
Django - Dealing with warnings - GeeksforGeeks | 22 Jul, 2021
Prerequisite : Django – Creating project
Django is a great framework which provides you a lot of pre-defined services and workflow so that one can work flawlessly. Django apps are designed to make your code clean and reusable. Django works on the concept of DRY which means Don’t Repeat Yourself.
After crea... | [
{
"code": null,
"e": 24380,
"s": 24352,
"text": "\n22 Jul, 2021"
},
{
"code": null,
"e": 24421,
"s": 24380,
"text": "Prerequisite : Django – Creating project"
},
{
"code": null,
"e": 24677,
"s": 24421,
"text": "Django is a great framework which provides you a ... |
What is covariant return type in Java? | Covariant return type refers to return type of an overriding method. It allows to narrow down return type of an overridden method without any need to cast the type or check the return type. Covariant return type works only for non-primitive return types.
From Java 5 onwards, we can override a method by changing its ret... | [
{
"code": null,
"e": 1317,
"s": 1062,
"text": "Covariant return type refers to return type of an overriding method. It allows to narrow down return type of an overridden method without any need to cast the type or check the return type. Covariant return type works only for non-primitive return types... |
How to Convert ArrayList to HashSet in Java? - GeeksforGeeks | 15 Nov, 2021
ArrayList: In Java, ArrayList can have duplicates as well as maintains insertion order.
HashSet: HashSet is the implementation class of Set. It does not allow duplicates and uses Hashtable internally.
There are four ways to convert ArrayList to HashSet :
Using constructor.Using add() method by iterating ov... | [
{
"code": null,
"e": 25262,
"s": 25234,
"text": "\n15 Nov, 2021"
},
{
"code": null,
"e": 25350,
"s": 25262,
"text": "ArrayList: In Java, ArrayList can have duplicates as well as maintains insertion order."
},
{
"code": null,
"e": 25463,
"s": 25350,
"text": "Ha... |
Truthy vs Falsy Values in Python - GeeksforGeeks | 05 Sep, 2020
In this article, we will see about the concept of Truthy and Falsy values in Python and also see how to determine a value is Truthy or Falsy by using bool() built-in Python function.
Now, Let’s start with the following two codes:
Python3
number = 7if number: print(number)
Output:
7
Let’s change value of... | [
{
"code": null,
"e": 25562,
"s": 25534,
"text": "\n05 Sep, 2020"
},
{
"code": null,
"e": 25745,
"s": 25562,
"text": "In this article, we will see about the concept of Truthy and Falsy values in Python and also see how to determine a value is Truthy or Falsy by using bool() built-... |
How to Iterate through a String word by word in C++ - GeeksforGeeks | 18 Oct, 2019
Given a String comprising of many words separated by space, the task is to iterate over these words of the string in C++.
Example:
Input: str = {“GeeksforGeeks is a computer science portal for Geeks”};Output:GeeksforGeeksisacomputerscienceportalforGeeks
Input: str = {“Geeks for Geeks”};Output:GeeksforGeeks... | [
{
"code": null,
"e": 25773,
"s": 25745,
"text": "\n18 Oct, 2019"
},
{
"code": null,
"e": 25895,
"s": 25773,
"text": "Given a String comprising of many words separated by space, the task is to iterate over these words of the string in C++."
},
{
"code": null,
"e": 2590... |
File getName() method in Java with Examples - GeeksforGeeks | 30 Jan, 2019
The getName() method is a part of File class. This function returns the Name of the given file object. The function returns a string object which contains the Name of the given file object.If the abstract path does not contain any name then a null string is returned.
Function Signature:
public String getNa... | [
{
"code": null,
"e": 25629,
"s": 25601,
"text": "\n30 Jan, 2019"
},
{
"code": null,
"e": 25897,
"s": 25629,
"text": "The getName() method is a part of File class. This function returns the Name of the given file object. The function returns a string object which contains the Name... |
What is the Basel Problem - GeeksforGeeks | 07 Jul, 2021
What is the Basel Problem :The Basel problem is an issue of Pietro Mengoli’s theory of numbers in 1644 and Leonhard Euler’s resolution in 1734. Since Euler’s solution stayed open for 90 years, at the age of 28 he was immediately renowned for discovering solution to this problem.This problem basically asks ... | [
{
"code": null,
"e": 26137,
"s": 26109,
"text": "\n07 Jul, 2021"
},
{
"code": null,
"e": 26622,
"s": 26137,
"text": "What is the Basel Problem :The Basel problem is an issue of Pietro Mengoli’s theory of numbers in 1644 and Leonhard Euler’s resolution in 1734. Since Euler’s solut... |
Convert all lowercase characters to uppercase whose ASCII value is co-prime with k - GeeksforGeeks | 15 Feb, 2022
Given an integer ‘k’ and a string ‘str’ consisting of characters from English alphabets. The task is to convert all lower case character to uppercase whose ASCII value is co-prime with k.Examples:
Input: str = “geeksforgeeks”, k = 4 Output: GEEKSfOrGEEKS ‘f’ and ‘r’ are the only characters whose ASCII val... | [
{
"code": null,
"e": 25465,
"s": 25437,
"text": "\n15 Feb, 2022"
},
{
"code": null,
"e": 25663,
"s": 25465,
"text": "Given an integer ‘k’ and a string ‘str’ consisting of characters from English alphabets. The task is to convert all lower case character to uppercase whose ASCII v... |
Maximum subsequence sum such that no three are consecutive - GeeksforGeeks | 30 Jan, 2022
Given a sequence of positive numbers, find the maximum sum that can be formed which has no three consecutive elements present.Examples :
Input: arr[] = {1, 2, 3}
Output: 5
We can't take three of them, so answer is
2 + 3 = 5
Input: arr[] = {3000, 2000, 1000, 3, 10}
Output: 5013
3000 + 2000 + 3 + 10 = 501... | [
{
"code": null,
"e": 26473,
"s": 26445,
"text": "\n30 Jan, 2022"
},
{
"code": null,
"e": 26611,
"s": 26473,
"text": "Given a sequence of positive numbers, find the maximum sum that can be formed which has no three consecutive elements present.Examples : "
},
{
"code": nul... |
Python | os.path.isfile() method - GeeksforGeeks | 28 Aug, 2019
OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality. os.path module is sub module of OS module in Python used for common path name manipulati... | [
{
"code": null,
"e": 25475,
"s": 25447,
"text": "\n28 Aug, 2019"
},
{
"code": null,
"e": 25786,
"s": 25475,
"text": "OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable... |
Auth Guards in Angular 9/10/11 - GeeksforGeeks | 03 Nov, 2021
AuthGuard is used to protect the routes from unauthorized access in angular.
How AuthGuard Works?
Auth guard provide lifecycle event called canActivate. The canActivate is like a constructor. It will be called before accessing the routes. The canActivate has to return true to access the page. If it returns... | [
{
"code": null,
"e": 26318,
"s": 26290,
"text": "\n03 Nov, 2021"
},
{
"code": null,
"e": 26395,
"s": 26318,
"text": "AuthGuard is used to protect the routes from unauthorized access in angular."
},
{
"code": null,
"e": 26416,
"s": 26395,
"text": "How AuthGuard... |
View Serializability in DBMS - GeeksforGeeks | 10 Jun, 2021
Prerequisite – Types of Schedules in DBMS View serializability is a concept that is used to compute whether schedules are View-Serializable or not. A schedule is said to be View-Serializable if it is view equivalent to a Serial Schedule (where no interleaving of transactions is possible).
Why do we need t... | [
{
"code": null,
"e": 25575,
"s": 25547,
"text": "\n10 Jun, 2021"
},
{
"code": null,
"e": 25866,
"s": 25575,
"text": "Prerequisite – Types of Schedules in DBMS View serializability is a concept that is used to compute whether schedules are View-Serializable or not. A schedule is s... |
Making a ring with VPython - GeeksforGeeks | 08 Jun, 2020
VPython makes it easy to create navigable 3D displays and animations, even for those with limited programming experience. Because it is based on Python, it also has much to offer for experienced programmers and researchers. VPython allows users to create objects such as spheres and cones in 3D space and di... | [
{
"code": null,
"e": 26089,
"s": 26061,
"text": "\n08 Jun, 2020"
},
{
"code": null,
"e": 26692,
"s": 26089,
"text": "VPython makes it easy to create navigable 3D displays and animations, even for those with limited programming experience. Because it is based on Python, it also ha... |
How to set the Width of the Drop-Down List in the ComboBox in C#? - GeeksforGeeks | 30 Jun, 2019
In Windows Forms, ComboBox provides two different features in a single control, it means ComboBox works as both TextBox and ListBox. In ComboBox, only one item is displayed at a time and the rest of the items are present in the drop-down menu. You are allowed to set the width in pixels of the drop-down lis... | [
{
"code": null,
"e": 25547,
"s": 25519,
"text": "\n30 Jun, 2019"
},
{
"code": null,
"e": 25965,
"s": 25547,
"text": "In Windows Forms, ComboBox provides two different features in a single control, it means ComboBox works as both TextBox and ListBox. In ComboBox, only one item is ... |
HTML5 | translate Attribute - GeeksforGeeks | 10 Aug, 2021
The translate attribute in HTML is used to specify whether the content of an element is translated or not. This attribute is new in HTML5.Supported Tags: It supports all HTML elements.
Syntax:
<element translate = "yes|no">
Attribute Values: The translate attribute contains two value which are listed be... | [
{
"code": null,
"e": 24414,
"s": 24386,
"text": "\n10 Aug, 2021"
},
{
"code": null,
"e": 24600,
"s": 24414,
"text": "The translate attribute in HTML is used to specify whether the content of an element is translated or not. This attribute is new in HTML5.Supported Tags: It suppor... |
Operator precedence in JavaScript - GeeksforGeeks | 25 Jun, 2020
Operator precedence refers to the priority given to operators while parsing a statement that has more than one operator performing operations in it. It is important to ensure the correct result and also to help the compiler understand what the order of operations should be. Operators with higher priorities... | [
{
"code": null,
"e": 26545,
"s": 26517,
"text": "\n25 Jun, 2020"
},
{
"code": null,
"e": 26955,
"s": 26545,
"text": "Operator precedence refers to the priority given to operators while parsing a statement that has more than one operator performing operations in it. It is importan... |
JavaScript | trimEnd() and trimRight() Method - GeeksforGeeks | 30 Dec, 2019
The trimEnd() method in JavaScript is used to remove white-space from the end of a string. The value of the string is not modified in any manner, including any white-space present before the string.
Syntax:
string.trimEnd()
Return Value: It returns the final string that is stripped out of all the white-spa... | [
{
"code": null,
"e": 26349,
"s": 26321,
"text": "\n30 Dec, 2019"
},
{
"code": null,
"e": 26548,
"s": 26349,
"text": "The trimEnd() method in JavaScript is used to remove white-space from the end of a string. The value of the string is not modified in any manner, including any whi... |
How to Add Multiple Columns in PySpark Dataframes ? - GeeksforGeeks | 30 Jun, 2021
In this article, we will see different ways of adding Multiple Columns in PySpark Dataframes.
Let’s create a sample dataframe for demonstration:
Dataset Used: Cricket_data_set_odi
Python3
# import pandas to read json fileimport pandas as pd # importing moduleimport pyspark # importing sparksession from ... | [
{
"code": null,
"e": 25537,
"s": 25509,
"text": "\n30 Jun, 2021"
},
{
"code": null,
"e": 25632,
"s": 25537,
"text": "In this article, we will see different ways of adding Multiple Columns in PySpark Dataframes. "
},
{
"code": null,
"e": 25683,
"s": 25632,
"tex... |
How to resize a tensor in PyTorch? | To resize a PyTorch tensor, we use the .view() method. We can increase or decrease the dimension of the tensor, but we have to make sure that the total number of elements in a tensor must match before and after the resize.
Import the required library. In all the following Python examples, the required Python library is... | [
{
"code": null,
"e": 1285,
"s": 1062,
"text": "To resize a PyTorch tensor, we use the .view() method. We can increase or decrease the dimension of the tensor, but we have to make sure that the total number of elements in a tensor must match before and after the resize."
},
{
"code": null,
... |
Transparency for Poly3DCollection plot in Matplotlib | To plot a transparent Poly3DCollection plot in Matplotlib, we can take the following steps −
Set the figure size and adjust the padding between and around the subplots
Create a new figure or activate an existing figure.
Add an '~.axes.Axes' to the figure as part of a subplot arrangement with projection=3d.
Create x, y ... | [
{
"code": null,
"e": 1155,
"s": 1062,
"text": "To plot a transparent Poly3DCollection plot in Matplotlib, we can take the following steps −"
},
{
"code": null,
"e": 1230,
"s": 1155,
"text": "Set the figure size and adjust the padding between and around the subplots"
},
{
... |
How can I see the CREATE TABLE statement of an existing MySQL table? | We can see the create table statement of an existing table by using SHOW CREATE TABLE query.
SHOW CREATE TABLE table_name;
mysql> Show create table employee\G
*************************** 1. row ***************************
Table: employee
Create Table: CREATE TABLE `employee` (
`Id` int(11) DEFAULT NULL,
`Name` va... | [
{
"code": null,
"e": 1155,
"s": 1062,
"text": "We can see the create table statement of an existing table by using SHOW CREATE TABLE query."
},
{
"code": null,
"e": 1185,
"s": 1155,
"text": "SHOW CREATE TABLE table_name;"
},
{
"code": null,
"e": 1468,
"s": 1185,
... |
SaltStack - Quick Guide | In this chapter, we will learn the basics of SaltStack. SaltStack’s remote execution capabilities allow administrators to run commands on various machines in parallel with a flexible targeting system. Salt configuration management establishes a master-minion model to quickly, very easily, flexibly and securely bringing... | [
{
"code": null,
"e": 2583,
"s": 2207,
"text": "In this chapter, we will learn the basics of SaltStack. SaltStack’s remote execution capabilities allow administrators to run commands on various machines in parallel with a flexible targeting system. Salt configuration management establishes a master-m... |
Spring Batch - Readers, Writers & Processors | An Item Reader reads data into the spring batch application from a particular source, whereas an Item Writer writes data from Spring Batch application to a particular destination.
An Item processor is a class which contains the processing code which processes the data read in to the spring batch. If the application rea... | [
{
"code": null,
"e": 2108,
"s": 1928,
"text": "An Item Reader reads data into the spring batch application from a particular source, whereas an Item Writer writes data from Spring Batch application to a particular destination."
},
{
"code": null,
"e": 2320,
"s": 2108,
"text": "An... |
CSS - Fade In Up Effect | The image come or cause to come gradually into or out of view, or to merge into another shot.
@keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
}
Transform − Transform applies to 2d and 3d transformation to an element.
Transform − Transform applies to 2d and 3d transformation to an element.
<html>
<hea... | [
{
"code": null,
"e": 2720,
"s": 2626,
"text": "The image come or cause to come gradually into or out of view, or to merge into another shot."
},
{
"code": null,
"e": 2786,
"s": 2720,
"text": "@keyframes fadeIn {\n 0% {opacity: 0;}\n 100% {opacity: 1;} \n} "
},
{
"code... |
C program to print characters and strings in different formats. | An algorithm is given below to explain the process which is included in the C programming language to print the characters and strings in different formats.
Step 1: Read a character to print.
Step 2: Read a name at compile time.
Step 3: Output of characters in different formats by using format specifiers.
printf("%c\n%... | [
{
"code": null,
"e": 1219,
"s": 1062,
"text": "An algorithm is given below to explain the process which is included in the C programming language to print the characters and strings in different formats."
},
{
"code": null,
"e": 1254,
"s": 1219,
"text": "Step 1: Read a character ... |
Date.toLocaleDateString() function in JavaScript | The Date object is a data type built into the JavaScript language. Date objects are created with the new Date( ) as shown below.
Once a Date object is created, a number of methods allow you to operate on it. Most methods simply allow you to get and set the year, month, day, hour, minute, second, and millisecond fields ... | [
{
"code": null,
"e": 1191,
"s": 1062,
"text": "The Date object is a data type built into the JavaScript language. Date objects are created with the new Date( ) as shown below."
},
{
"code": null,
"e": 1454,
"s": 1191,
"text": "Once a Date object is created, a number of methods al... |
SQLite - Injection | If you take user input through a webpage and insert it into a SQLite database there's a chance that you have left yourself wide open for a security issue known as SQL Injection. In this chapter, you will learn how to help prevent this from happening and help you secure your scripts and SQLite statements.
Injection usua... | [
{
"code": null,
"e": 2944,
"s": 2638,
"text": "If you take user input through a webpage and insert it into a SQLite database there's a chance that you have left yourself wide open for a security issue known as SQL Injection. In this chapter, you will learn how to help prevent this from happening and... |
HTML - Fonts | Fonts play a very important role in making a website more user friendly and increasing content readability. Font face and color depends entirely on the computer and browser that is being used to view your page but you can use HTML <font> tag to add style, size, and color to the text on your website. You can use a <base... | [
{
"code": null,
"e": 2763,
"s": 2374,
"text": "Fonts play a very important role in making a website more user friendly and increasing content readability. Font face and color depends entirely on the computer and browser that is being used to view your page but you can use HTML <font> tag to add styl... |
How to override derived properties in JavaScript? | Following is the code to override derived properties in JavaScript −
Live Demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans... | [
{
"code": null,
"e": 1131,
"s": 1062,
"text": "Following is the code to override derived properties in JavaScript −"
},
{
"code": null,
"e": 1142,
"s": 1131,
"text": " Live Demo"
},
{
"code": null,
"e": 2650,
"s": 1142,
"text": "<!DOCTYPE html>\n<html lang=\"e... |
Can we store objects in an array in Java? | Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of Array.
Element: Each item stored in an array is called an element.
Index: Eac... | [
{
"code": null,
"e": 1312,
"s": 1062,
"text": "Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of Array."
... |
Deep Learning GPU Installation on Ubuntu 18.4 | by Ana Solaguren-Beascoa, PhD | Towards Data Science | After several times of installing with drivers, CUDA etc... to make my deep learning libraries talk to my GPU, I have decided to write the installation steps that work for Ubuntu18.04.
The first thing one needs to do, is ensure that the GPU is an NVIDIA GPU with the following command:
$ ubuntu-drivers devices
The first... | [
{
"code": null,
"e": 357,
"s": 172,
"text": "After several times of installing with drivers, CUDA etc... to make my deep learning libraries talk to my GPU, I have decided to write the installation steps that work for Ubuntu18.04."
},
{
"code": null,
"e": 458,
"s": 357,
"text": "T... |
Check if string S2 can be obtained by appending subsequences of string S1 - GeeksforGeeks | 16 Sep, 2021
Given two strings S1 and S2, the task is to check if it’s possible to generate string S2 by repeatedly appending subsequences of S1 to the end of an initially empty string. If possible, print “YES” and the minimum number of operations required. Otherwise, print “NO“.
Examples:
Input: S1 = “acebcd”, S2 = “a... | [
{
"code": null,
"e": 25223,
"s": 25195,
"text": "\n16 Sep, 2021"
},
{
"code": null,
"e": 25491,
"s": 25223,
"text": "Given two strings S1 and S2, the task is to check if it’s possible to generate string S2 by repeatedly appending subsequences of S1 to the end of an initially empt... |
Sum of squares of first n natural numbers in C Program? | The sum of squares of the first n natural numbers is found by adding up all the squares.
Input - 5Output - 55Explanation - 12 + 22 + 32 + 42 + 52
There are two methods to find the Sum of squares of first n natural numbers −
Using Loops − the code loops through the digits until n and find their square, then add this to ... | [
{
"code": null,
"e": 1151,
"s": 1062,
"text": "The sum of squares of the first n natural numbers is found by adding up all the squares."
},
{
"code": null,
"e": 1208,
"s": 1151,
"text": "Input - 5Output - 55Explanation - 12 + 22 + 32 + 42 + 52"
},
{
"code": null,
"e":... |
Sampling Large Graphs in PyTorch Geometric | by Mike Chaykowsky | Towards Data Science | Sometimes we encounter large graphs that force us beyond the available memory of our GPU or CPU. In these cases, we can utilize graph sampling techniques. PyTorch Geometric is a graph deep learning library that allows us to easily implement many graph neural network architectures with ease. The library contains many st... | [
{
"code": null,
"e": 1085,
"s": 172,
"text": "Sometimes we encounter large graphs that force us beyond the available memory of our GPU or CPU. In these cases, we can utilize graph sampling techniques. PyTorch Geometric is a graph deep learning library that allows us to easily implement many graph ne... |
Ruby - Blocks | You have seen how Ruby defines methods where you can put number of statements and then you call that method. Similarly, Ruby has a concept of Block.
A block consists of chunks of code.
A block consists of chunks of code.
You assign a name to a block.
You assign a name to a block.
The code in the block is always enclose... | [
{
"code": null,
"e": 2443,
"s": 2294,
"text": "You have seen how Ruby defines methods where you can put number of statements and then you call that method. Similarly, Ruby has a concept of Block."
},
{
"code": null,
"e": 2479,
"s": 2443,
"text": "A block consists of chunks of cod... |
Random name generator function in JavaScript | We are required to write a JavaScript function that takes in a number n and returns a random string of length n containing no other than the 26 English lowercase alphabets
Let us write the code for this function −
const num = 8;
const randomNameGenerator = num => {
let res = '';
for(let i = 0; i < num; i++){
... | [
{
"code": null,
"e": 1234,
"s": 1062,
"text": "We are required to write a JavaScript function that takes in a number n and returns a random string of length n containing no other than the 26 English lowercase alphabets"
},
{
"code": null,
"e": 1276,
"s": 1234,
"text": "Let us wri... |
How to determine whether C++ code has been compiled in 32 or 64 bit? | In C++, there is no direct way to check the environment architecture. There are two Macros for Windows systems, that can be used to check the architecture. These macros are _WIN64, and _WIN32. When the system is 64-bit, then the _WIN64 will be 1, otherwise the _WIN32 will be 1. So using macro checking, we can identify ... | [
{
"code": null,
"e": 1399,
"s": 1062,
"text": "In C++, there is no direct way to check the environment architecture. There are two Macros for Windows systems, that can be used to check the architecture. These macros are _WIN64, and _WIN32. When the system is 64-bit, then the _WIN64 will be 1, otherw... |
Python | Thresholding techniques using OpenCV | Set-2 (Adaptive Thresholding) - GeeksforGeeks | 06 May, 2019
Prerequisite: Simple Thresholding using OpenCV
In the previous post, Simple Thresholding was explained with different types of thresholding techniques. Another Thresholding technique is Adaptive Thresholding. In Simple Thresholding, a global value of threshold was used which remained constant throughout. S... | [
{
"code": null,
"e": 41554,
"s": 41526,
"text": "\n06 May, 2019"
},
{
"code": null,
"e": 41601,
"s": 41554,
"text": "Prerequisite: Simple Thresholding using OpenCV"
},
{
"code": null,
"e": 42205,
"s": 41601,
"text": "In the previous post, Simple Thresholding w... |
Change Labels of GGPLOT2 Facet Plot in R - GeeksforGeeks | 30 Jun, 2021
In this article, we will see How To Change Labels of ggplot2 Facet Plot in R Programming language.
To create a ggplot2 plot, we have to load ggplot2 package. library() function is used for that. Then either create or load dataframe. Create a regular plot with facets. The labels are added by default.
Examp... | [
{
"code": null,
"e": 25242,
"s": 25214,
"text": "\n30 Jun, 2021"
},
{
"code": null,
"e": 25342,
"s": 25242,
"text": "In this article, we will see How To Change Labels of ggplot2 Facet Plot in R Programming language. "
},
{
"code": null,
"e": 25544,
"s": 25342,
... |
Differentiate between categorical and numerical independent variables in R. | For categorical variable, each level is considered as an independent variable and is
recognized by factor function. On the other hand, the numerical independent variable is
either continuous or discrete in nature.
Check out the Example given below for linear regression model summary to understand
the difference between... | [
{
"code": null,
"e": 1276,
"s": 1062,
"text": "For categorical variable, each level is considered as an independent variable and is\nrecognized by factor function. On the other hand, the numerical independent variable is\neither continuous or discrete in nature."
},
{
"code": null,
"e": ... |
Distance between Incenter and Circumcenter of a triangle using Inradius and Circumradius - GeeksforGeeks | 19 Oct, 2021
Given two integers r and R representing the length of Inradius and Circumradius respectively, the task is to calculate the distance d between Incenter and Circumcenter.
Inradius The inradius( r ) of a regular triangle( ABC ) is the radius of the incircle (having center as l), which is the largest circle th... | [
{
"code": null,
"e": 25302,
"s": 25274,
"text": "\n19 Oct, 2021"
},
{
"code": null,
"e": 25471,
"s": 25302,
"text": "Given two integers r and R representing the length of Inradius and Circumradius respectively, the task is to calculate the distance d between Incenter and Circumce... |
PyQt5 QCalendarWidget - Setting Selected Date - GeeksforGeeks | 04 Jul, 2021
In this article we will see how we can set the selected date of QCalendarWidget, selected date is the date that is currently highlighted user can change the selected date using the mouse and cursor by default selected date is the real-time date although we can set the selected date any time.Note: The selec... | [
{
"code": null,
"e": 25192,
"s": 25164,
"text": "\n04 Jul, 2021"
},
{
"code": null,
"e": 25596,
"s": 25192,
"text": "In this article we will see how we can set the selected date of QCalendarWidget, selected date is the date that is currently highlighted user can change the select... |
A Machine Learning Approach — Building a Hotel Recommendation Engine | by Susan Li | Towards Data Science | All online travel agencies are scrambling to meet the AI driven personalization standard set by Amazon and Netflix. In addition, the world of online travel has become a highly competitive space where brands try to capture our attention (and wallet) with recommending, comparing, matching and sharing.
In this post, we ai... | [
{
"code": null,
"e": 473,
"s": 172,
"text": "All online travel agencies are scrambling to meet the AI driven personalization standard set by Amazon and Netflix. In addition, the world of online travel has become a highly competitive space where brands try to capture our attention (and wallet) with r... |
C++ Program to find size of int, float, double and char in Your System | There are many data types in C++ but the most frequently used are int, float, double and char. Some details about these data types are as follows −
int - This is used for integer data types which normally require 4 bytes of memory space.
int - This is used for integer data types which normally require 4 bytes of memory... | [
{
"code": null,
"e": 1210,
"s": 1062,
"text": "There are many data types in C++ but the most frequently used are int, float, double and char. Some details about these data types are as follows −"
},
{
"code": null,
"e": 1300,
"s": 1210,
"text": "int - This is used for integer dat... |
Animated Data Visualization using Plotly Express - GeeksforGeeks | 22 Jun, 2020
Data Visualization is a big thing in the data science industry and displaying the proper statistics to a business or governments can help them immeasurably in improving their services. It is very painful to understand data from different times from multiple charts and make any sense of it. That is where th... | [
{
"code": null,
"e": 23420,
"s": 23392,
"text": "\n22 Jun, 2020"
},
{
"code": null,
"e": 23970,
"s": 23420,
"text": "Data Visualization is a big thing in the data science industry and displaying the proper statistics to a business or governments can help them immeasurably in impr... |
How to find the sum of column values of an R data frame? | An R data frame contain columns that might represent a similar type of variables; therefore, we might want to find the sum of the values for each of the columns and make a comparison based on the sum. This can be done with the help of sum function but first we need to extract the columns to find the sum.
Consider the b... | [
{
"code": null,
"e": 1368,
"s": 1062,
"text": "An R data frame contain columns that might represent a similar type of variables; therefore, we might want to find the sum of the values for each of the columns and make a comparison based on the sum. This can be done with the help of sum function but f... |
HTML5 Canvas - Drawing Rectangles | There are three methods that draw rectangles on the canvas −
fillRect(x,y,width,height)
This method draws a filled rectangle.
strokeRect(x,y,width,height)
This method draws a rectangular outline.
clearRect(x,y,width,height)
This method clears the specified area and makes it fully transparent
Here x and y specify the po... | [
{
"code": null,
"e": 2669,
"s": 2608,
"text": "There are three methods that draw rectangles on the canvas −"
},
{
"code": null,
"e": 2696,
"s": 2669,
"text": "fillRect(x,y,width,height)"
},
{
"code": null,
"e": 2734,
"s": 2696,
"text": "This method draws a fil... |
C# | Copy Constructor - GeeksforGeeks | 04 Dec, 2021
A constructor that creates an object by copying variables from another object or that copies the data of one object into another object is termed as the Copy Constructor. It is a parameterized constructor that contains a parameter of the same class type. The main use of copy constructor is to initialize a ... | [
{
"code": null,
"e": 24398,
"s": 24370,
"text": "\n04 Dec, 2021"
},
{
"code": null,
"e": 24935,
"s": 24398,
"text": "A constructor that creates an object by copying variables from another object or that copies the data of one object into another object is termed as the Copy Const... |
Process ~10M Row Datasets in Milliseconds In This Comprehensive Pandas Speed Guide | Towards Data Science | “Great... another article on how to make Pandas n times faster.”
I think I have said that countless times for the past two years I have been using Pandas. The most recent one I saw said, “make Pandas 71,803 times faster”.
But I won’t give you that kind of promise. I will just show you how to use Pandas in the fastest w... | [
{
"code": null,
"e": 112,
"s": 47,
"text": "“Great... another article on how to make Pandas n times faster.”"
},
{
"code": null,
"e": 269,
"s": 112,
"text": "I think I have said that countless times for the past two years I have been using Pandas. The most recent one I saw said, ... |
Julia - Functions | Function, the building blocks of Julia, is a collected group of instructions that maps a tuple of argument values to a return value. It acts as the subroutines, procedures, blocks, and other similar structures concepts found in other programming languages.
There are following three ways in which we can define functions... | [
{
"code": null,
"e": 2335,
"s": 2078,
"text": "Function, the building blocks of Julia, is a collected group of instructions that maps a tuple of argument values to a return value. It acts as the subroutines, procedures, blocks, and other similar structures concepts found in other programming languag... |
How to change number formatting from scientific to numbers of axes labels in a scatterplot using ggplot2 package in R? | When we create a scatterplot or any other plot and the values are presented in scientific form in the original data then the axes values of the plot are also plotted in scientific form. This makes the plot ambiguous, therefore, reading the plot or interpreting it becomes difficult. Hence, we need to convert the scienti... | [
{
"code": null,
"e": 1539,
"s": 1062,
"text": "When we create a scatterplot or any other plot and the values are presented in scientific form in the original data then the axes values of the plot are also plotted in scientific form. This makes the plot ambiguous, therefore, reading the plot or inter... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.