
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 26504 Articles for Server Side Programming

296 Views
Suppose we have an array with even length, here different numbers in this array will represent different kinds of candies. Now each number means one candy of the corresponding kind. we have to distribute candies equally in number to brother and sister. We have to find the maximum number of kinds of candies the sister could receive.So, if the input is like [1, 1, 2, 3], then the output will be 2 as if we consider the sister has candies [2, 3] and the brother has candies [1, 1]. Now the sister has two different kinds of candies, the brother ... Read More

2K+ Views
In different platform there is very useful function called 'reshape', that function is used to reshape a matrix into a new one with different size but data will be same. So, if we have a matrix and two values r and c for the row number and column number of the wanted reshaped matrix, respectively.So, if the input is like [[5, 10], [15, 20]], row = 1 and col = 4, then the output will be [[5, 10, 15, 20]]To solve this, we will follow these steps−Define an array tempDefine one 2D array res of size (r x c)count := ... Read More

249 Views
Definition and UsageThe asin() function returns the arc sine or sine inverse of arg in radians. asin() is the inverse function of sin(). Therefore if sin(x)=y, asin(y)=x.For example, sin(pi/2)=1 and asin(1)=1.57079633 rad which is equal to pi/2.This function returns a float value.Syntaxasin ( float $arg ) : floatParametersSr.NoParameter & Description1argA floating point number whose arc sine is to be calculated. Number should be withing -1 to 1Return ValuesPHP asin() function returns arc sine of given number. It is angle represented in radians.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example calculates ... Read More

265 Views
Definition and UsageThe acosh() function returns the inverse hyperbolic cosine ratio of given angle in of given parameter. In other words, the return value of asinh() is hyperbolic sine of given parameter. A hyperbolic inverse hyperbolic cosine function is defined as −.acosh(x) = log(x+sqrt(pow(x, 2)-1))This function returns a float value.Syntaxacosh ( float $arg ) : floatParametersSr.NoParameter & Description1argA floating point value whose inverse hyperbolic cosine is to be calculatedReturn ValuesPHP acosh() function returns inverse hyperbolic cosine ratio of given parameter.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.ExampleFollowing example calculates acosh(pi/2) and returns ... Read More

295 Views
Definition and UsageThe acos() function Returns the arc cosine or cos inverse of arg in radians. acos() is the inverse function of cos(). Therefore if cos(x)=y, acos(y)=x.For example, cos(pi/2)=0 and acos(0)=1.57079633 rad which is equal to pi/2.This function returns a float value.Syntaxacos ( float $arg ) : floatParametersSr.NoParameter & Description1argA floating point number whose arc cosine is to be calculated. Number should be withing -1 to 1Return ValuesPHP acos() function returns arc cosine of given number. It is angle represented in radians.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example calculates ... Read More

3K+ Views
Definition and UsageThe abs() function is an in-built function in PHP iterpreter. This function accepts any number as argument and returns a positive value, disregarding its sign. Absolute value of any number is always positive.This function always returns positive number.Syntaxabs( mixed $num)ParametersSr.NoParameter & Description1numThis parameter stores a value whose absolute value is to be obtained.Return ValuesPHP abs() function returns absolute value of num. If data type of num is float, return type is also float.For integer parameter, return type is integer.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example shows that ... Read More

172 Views
Suppose we have a Binary Search Tree, we have to convert it into a Greater Tree such that every key of the original BST is changed to the original key + sum of all keys greater than the original key in BST.So, if the input is likethen the output will beTo solve this, we will follow these steps −Define a function revInorder(), this will take tree root and s, if root is null, then −returnrevInorder(right of root, s)s := s + val of rootval of root := srevInorder(left of root, s)From the main method, do the following −if root is ... Read More

353 Views
Suppose we have an array and an integer k, we have to find the number of unique k-diff pairs in the array. Here the k-diff pair is like (i, j), where i and j are both are present in the array and their absolute difference is k.So, if the input is like [3, 1, 4, 1, 5], k = 2, then the output will be 2, as there are two 2-diff pairs in the array-like (1, 3) and (3, 5).To solve this, we will follow these steps −Define maps called seen and doneDefine one set sif k < 0, then ... Read More

215 Views
Suppose we have two strings; we have to find the longest uncommon subsequence of these two strings. The longest uncommon subsequence is actually the longest subsequence of one string and this subsequence should not come in the other string. So, we have to find the length of the longest uncommon subsequence. If the longest uncommon subsequence doesn't exist, return -1.So, if the input is like "aabbac", "aabbcc", then the output will be 6To solve this, we will follow these steps −if a is same as b, then −return -1Otherwisereturn maximum of size of a and size of bExample Let us see ... Read More

2K+ Views
Suppose we have to check whether a given number is perfect number or not. A number is said to be a Perfect Number when that is equal to the sum of all its positive divisors except itself. The number n will be in range 1^8.So, if the input is like 28, then the output will be True, as its sum of divisors − 1 + 2 + 4 + 7+ 14 = 28.To solve this, we will follow these steps −As the numbers are in range 10^8, there are only few perfect numbers, if the given input is in that ... Read More