
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

538 Views
In this problem, we are given an integer N. The task is to find the n-th term in series 1, 4, 27, 16, 125, 36, 343....Let’s take an example to understand the problem, InputN = 7Output343ExplanationThe series is 1, 4, 27, 16, 125, 36, 343…Solution ApproachA simple solution to the problem is by finding the general term of the series. This series comprises two different series one at odd terms and one at even terms. If the current element index is even, the element is square of its index. And if the current element index is odd, the element is ... Read More

396 Views
In this problem, we are given an integer N. The task is to find n-th term in series 9, 33, 73, 129....Let’s take an example to understand the problem, InputN = 4Output129ExplanationThe series upto nth term is 9, 33, 73, 129...Solution ApproachThe solution to the problem lies in finding the nth term of the series. We will find it mathematically and then apply the general term formula to our program.First let’s subtract the series by shifting it by one.Sum = 9 + 33 + 73 + … + t(n-1) + t(n) - Sum = 9 + 33 + 73 + ... Read More

170 Views
In this problem, we are given an integer N. The task is to find n-th term in series 7, 15, 32....Let’s take an example to understand the problem, InputN = 6Output281ExplanationThe series upto nth term is 7, 15, 32, 67, 138, 281Solution ApproachThe solution to the problem lies in decoding the series. You can see the series is a mix of series.The subtracting the values, T(2) - T(1) = 15 - 7 = 8 T(3) - T(2) = 32 - 15 = 17 So, T(2) = 2*T(1) + 1 T(3) = 2*T(2) + 2 T(n) = 2*T(n-1) + ... Read More

375 Views
In this problem, we are given an integer N. The task is to find n-th term in series 1 2 2 3 3 3 4….Let’s take an example to understand the problem, InputN = 6Output3ExplanationThe series upto nth term is 1, 2, 2, 3, 3, 3, ...Solution ApproachA simple approach to solve the problem is by using a nested loop. The outer for loop is from 1 to n. And the inner loop is from 1 to i (iterator of outer loop). For each iteration in the inner loop, count the number of elements of the series and return the ... Read More

363 Views
In this problem, we are given a binary tree and an integer N. The task is to find the n-th node in inorder traversal of a Binary Tree.A binary tree has a special condition that each node can have a maximum of two children.Traversal is a process to visit all the nodes of a tree and may print their values too.Let’s take an example to understand the problem, InputN = 6Output3Explanationinorder traversal of tree : 4, 2, 5, 1, 6, 3, 7Solution ApproachThe idea is to use the in-order traversal of the binary tree which is done by using recursive ... Read More

260 Views
In this problem, we are given a binary tree and an integer N. The task is to find the n-th node in Preorder traversal of a Binary Tree.A binary tree has a special condition that each node can have a maximum of two children.Traversal is a process to visit all the nodes of a tree and may print their values too.Let’s take an example to understand the problem, InputN = 6Output6ExplanationPre order traversal of tree : 1, 2, 4, 5, 3, 6, 7Solution ApproachThe idea is to use the pre-order traversal of the binary tree which is done by using ... Read More

465 Views
In the older versions of PHP, we faced an inconsistency problem. For example: ${$first [‘name’]}. This syntax may create confusion or we can say that the syntax is not consistent. To overcome the inconsistency problem, PHP 7 added the new syntax called “Uniform variable syntax”.The uniform variable syntax evaluates the variables from left to right.We need to add the curly brackets to use the uniform variable syntax. For example, echo ${$first[‘name’]};The uniform variable syntax allows the combinations of operators and also it can break the backward compatibility in some expressions wherever older evaluations are used.ExampleLive DemoOutputOutput for the above PHP ... Read More

646 Views
PHP 7 takes a Unicode codepoint in hexadecimal form as input and produces the outputs in UTF-8 character format within a double-quoted string. It could be any combination of hexadecimal digits, 2, 4, 6, and above. We can write Unicode characters by using a double-quoted or here docstring, without calling a function. Leading zero is optional in any hexadecimal form. UTF-8 Character Note: We can construct the full Unicode characters using “\u{xxx}” syntax.Some languages, for example, Hebrew and Arabic are read from right to left instead of left to right. We can reverse the text using the ... Read More

14K+ Views
An array in PHP is a type of data structure that can store multiple elements of similar data type under a single variable.To display array structure and values in PHP, we can use two functions. We can use var_dump() or print_r() to display the values of an array in human-readable format or to see the output value of the program array.Difference between print_r and var_dumpprint_r: It is used to display the variable information in a human-readable format. Array values will be present in a format so that keys and elements can show. print_r also shows protected and private properties of ... Read More

513 Views
In the earlier versions of PHP, we could handle only exceptions. It was not possible to handle errors. In the case of a Fatal Error, it used to halt the complete application or some part of the application. To overcome this problem, PHP 7 added the throwableinterface to handle both exceptions and errors.Exception: Wherever a fatal and recoverable error occurs, PHP 7 throws an exception instead of halting the complete application or script execution.Error: PHP 7 throwsTypeError, ArithmeticError, ParserError, and AssertionError, but the warnings and notice errors remain unchanged. Using the try/catch block, error instance can be caught, and now, the ... Read More