Given an array which is a collection of non-negative number represented as an array of digits, add 1 to the number (increment the number represented by the digits ). The digits are stored such that the most significant digit is the first element of the array.To add 1 to the number represented by digitsGiven array from the end, addition means rounding of the last no 4 to 5.If the last elements 9, make it 0 and carry = 1.For the next iteration check carry and if it adds to 10, do the same as step 2.After adding carry, make carry ... Read More
The HTML DOM Input Search autofocus property is associated with the HTML element’s autofocus attribute. This property is used for setting or returning if the input search field should automatically be focused when the page loads or not.SyntaxFollowing is the syntax for −Setting the autofocus property −searchObject.autofocus = true|falseHere, true represents the search field should get focus and false represents otherwise. It is set to false by default.ExampleLet us look at an example of the Input search autofocus property − Input search autofocus property FRUITS: Get the autofocus attribute value for the above search ... Read More
The acosh() is the inverse hyperbolic cosine function that returns the inverse hyperbolic cosine of the element passed as parameter. this dysfunction can be out operate over complete. all the it are in radians.To use this method over complex numbers in C plus plus we need to define a template which redefines the function over complex numbers.Syntax for the function that is used to calculate the inverse hyperbolic cosine of a complex number and Returns the value −template complex acosh (const complex& z );Now this method will take complex number as an input and returns the Arc hyperbolic cosine of ... Read More
The asinh() function is a function of standard C++ library. The asinh(value) is an inverse hyperbolic sine that returns the value of sinh(x) where x is in radian.The function −asinh() ;Parameter to the function, inverse hyperbolic angle in radian . It can be negative, positive or zero. The parameter value can be double, float or long double.Return value − It returns the inverse hyperbolic sine value of the input value. The returned value is in radians.Lets see an example that shows the working of the function −Example#include using namespace std; int main() { double insinh = 75.0; double ... Read More
Symmetric Matrix − A matrix whose transpose is equal to the matrix itself. Then it is called a symmetric matrix.Skew-symmetric matrix − A matrix whose transpose is equal to the negative of the matrix, then it is called a skew-symmetric matrix.The sum of symmetric and skew-symmetric matrix is a square matrix. To find these matrices as the sum we have this formula.Let A be a square matrix. then, A = (½)*(A + A`)+ (½ )*(A - A`), A` is the transpose of the matrix.(½ )(A+ A`) is symmetric matrix.(½ )(A - A`) is a skew-symmetric matrix.Example#include using namespace std; ... Read More
The sum of square-sums of the first n natural numbers is finding the sum of sum of squares upto n terms. This series finds the sum of each number upto n, and adds this sums to a sum variable.The sum of square-sum of first 4 natural numbers is −sum = (12) + (12 + 22 ) + (12 + 22 + 32) + (12 + 22 + 32 + 42 ) = 1 + 5 + 14 + 30 = 50There are two methods to find the sum of square-sum of first n natural numbers.1) Using the for loop.In this ... Read More
The series of squares of first n odd numbers takes squares of of first n odd numbers in series.The series is: 1,9,25,49,81,121…The series can also be written as − 12, 32, 52, 72, 92, 112….The sum of this series has a mathematical formula −n(2n+1)(2n-1)/ 3= n(4n2 - 1)/3Lets take an example,Input: N = 4 Output: sum =Explanation12 + 32 + 52 + 72 = 1 +9+ 25 + 49 = 84Using formula, sum = 4(4(4)2- 1)/3 = 4(64-1)/3 = 4(63)/3 = 4*21 = 84 both these methods are good but the one using mathematical formula is better because it does not use looks which reduces its time complexity.Example#include int main() { int n = 8; int sum = 0; for (int i = 1; i
The HTML DOM Input Reset type property is associated with the input element having its type=”reset”. It will always return reset for the input reset element.SyntaxFollowing is the syntax for reset type property −resetObject.typeExampleLet us look at an example for the reset type property − Input reset type Property UserName: Location: Get the above input element type by clicking the below button GET Type function resetType() { var P=document.getElementById("RESET1").type; document.getElementById("Sample").innerHTML = "The type for the input field is: "+P ; } ... Read More
A Set is a collection of data elements. Subset of a set is a set formed by only the elements after parent set. for example, B is A subset of a if all elements of B exist in A.Here we need to find the sum of all subsets of a set found by first n natural numbers. this means I need to find all subsets that can be formed and then adding them. Let's take an example, N = 3Set = {1, 2, 3}subsets formed = { {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3, } ... Read More
An arithmetic progression (AP) is a series of numbers in which the difference between two consecutive terms in the same. The difference is calculated by subtracting the second term from the first.Let's take a sample sequence to know about AP, 5, 7, 9, 11, 13, 15, . . . The common difference(d) of this arithmetic progression is 2. This means every succeeding element differs the former one by 2. The first term (a) of this series is 5.The general formula for finding the nth term is a{n} = a + (n-1)(d)In this problem, we are given an AP and we ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP