Server Side Programming Articles - Page 1932 of 2650

Convert Hexadecimal value String to ASCII value String in C++

Ayush Gupta
Updated on 22-Jan-2020 07:00:38

2K+ Views

In this tutorial, we will be discussing a program to convert hexadecimal value string to ASCII value string.For this we will be provided with a string with some hexadecimal values. Our task is to get that hexadecimal value and convert it into equivalent ASCII values.Example Live Demo#include using namespace std; string convert_ASCII(string hex){    string ascii = "";    for (size_t i = 0; i < hex.length(); i += 2){       //taking two characters from hex string       string part = hex.substr(i, 2);       //changing it into base 16       char ch ... Read More

How to Install PHP 7 on Ubuntu Linux 14.04 LTS

Sharon Christine
Updated on 22-Jan-2020 06:58:20

603 Views

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. Originally created by Rasmus Lerdorf in 1994, the PHP reference implementation is now produced by The PHP Group. The latest version PHP is PHP7 and it provides 2x faster performance and 50% better memory consumption than PHP version 5.6. This article explains “How to install PHP7 on Ubuntu Linux”.Before installing PHP7, you should need to install a PPA called ondrej/php. This allows you to co-install PHP versions 5.6 and 7.0.Configuring a PPA for co-installable PHP 5.6 + 7.0To configure a PPA, use ... Read More

Convert given time into words in C++

Ayush Gupta
Updated on 22-Jan-2020 06:56:25

330 Views

In this tutorial, we will be discussing a program to convert given time into words. For this we will be provided with a specific time in the digital format.Our task is to convert that particular time into wordsExample#include using namespace std; //printing time in words void convert_time(int h, int m){    char nums[][64] = {       "zero", "one", "two", "three", "four",       "five", "six", "seven", "eight",       "nine", "ten", "eleven", "twelve",       "thirteen", "fourteen", "fifteen",       "sixteen", "seventeen", "eighteen",       "nineteen", "twenty", "twenty       one", ... Read More

Maximum spiral sum in Binary Tree in C++

Narendra Kumar
Updated on 03-Jun-2020 08:17:12

183 Views

In this problem, we are given a binary tree. Our task is to create a program that will find the maximum spiral sum in a binary tree in C++.Spiral sum of a binary tree is the sum of nodes that are encountered in the spiral traversal of the binary tree.In the spiral traversal of a tree, the nodes are traversed from the root to the leaf node. The traversal takes place from left to right then for the next level from right to left and so on for the further levels.Example −Output −5Explanation −We will consider the spiral traversal until the ... Read More

Maximum size subset with given sum in C++

Narendra Kumar
Updated on 21-Jan-2020 11:30:13

782 Views

Problem statementGiven an array of N elements and sum. We need to find size of maximum size subset whose sum is equal to given sumExampleIf input array is arr = { 2, 3, 5, 10 } and sum = 20 then output will be 4 as −2 + 3 + 5 + 10 = 20 which is equal to given sumAlgorithmWe can use dynamic programming to solve this problem.To count the maximal subset, we use another DP array (called as ‘count array’) where count[i][j] is maximal of.count[i][j-1]. Here current element is not considered.scount[i- X][j-1] + 1. Here X is value ... Read More

Maximum segment value after putting k breakpoints in a number in C++

Narendra Kumar
Updated on 03-Jun-2020 08:19:11

274 Views

In this problem, we are given a string that denotes a large number and an integer k roar denotes the number of breakpoints. Our task is to create a program that will find the maximum segment value after putting L breakpoints in a number.Here, we have to find the maximum number that can be generated after putting k breakpoint in the number given by the string.Let's take an example to understand the problemInput − string = “45972”, k = 3Output − 97Explanation −All possible number is: 45    9    7    2 4    59    7    2 ... Read More

Maximum removal from array when removal time >= waiting time in C++

Narendra Kumar
Updated on 03-Jun-2020 08:20:38

133 Views

In this problem, we are given an array of N elements. Our task is to find the maximum removal from the array when removal time >= waiting time.So, here we will be removing the elements of the array. The value of the element of the array denotes the removal time(time taken to remove the element from the array).The element has a waiting time which is the time it will have to wait till it will get removed.The element can be removed from the only if the removal time is greater than the time it has to wait.We have to find ... Read More

Maximum profit from sale of wines in C++

Narendra Kumar
Updated on 21-Jan-2020 11:17:53

214 Views

Problem statementGiven n wines in a row, with integers denoting the cost of each wine respectively. Each year you can sale the first or the last wine in the row. The price of wines increases over time. Let the initial profits from the wines be P1, P2, P3…Pn. On the Yth year, the profit from the ith wine will be Y*Pi. For each year, your task is to print start or end denoting whether first or last wine should be sold. Also, calculate the maximum profit from all the wines.ExampleIf wine prices are {2, 4, 6, 2, 5} then output ... Read More

Maximum Primes whose sum is equal to given N in C++

Narendra Kumar
Updated on 03-Jun-2020 08:21:44

193 Views

In this problem, we are given a number n. Our task is to find the maximum count of primes whose sum is equal to given N.Here, we will find the maximum number of prime numbers that when added will be equal to the number.The prime number are those number which can be divide by either themselves or one.let's take an example to understand the problem −Input − N = 9Output − 4Explanation −9 can be repressed as the sum of prime numbers in the following ways: 2, 2, 2, 3 3, 3, 3 2, 2, 5 2, 7 Out of ... Read More

Maximum prefix-sum for a given range in C++

Narendra Kumar
Updated on 21-Jan-2020 11:10:19

733 Views

Problem statementGiven an array of n integers and q queries, each query having a range from l to r. Find the maximum prefix-sum for the range l – r.ExampleIf input array is arr[] = {-1, 2, 3, -5} and queries = 2 and ranges are: l = 0, r = 3 l = 1, r = 3 then output will be 4 and 5.The range (0, 3) in the 1st query has [-1, 2, 3, -5], since it is prefix, we have to start from -1. Hence, the max prefix sum will be -1 + 2 + 3 = 4The ... Read More

Advertisements