Server Side Programming Articles

Page 1425 of 2109

Goat Latin in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 707 Views

Suppose we have a set of strings (Sentence), in that set there are few words. Each words are consists of lowercase and uppercase letters. Our task is to convert the sentence into Goat-Latin form. The Goat Latin is similar to the Pig Latin. There are some few conditions.If the word starts with a vowel, then append ‘ma’ with the wordIt the word starts with a consonant, then remove that from beginning, and append it at the end, then add ‘ma’ at the end.Add one letter ‘a’ to the end of each word per its word index in the sentence, starting ...

Read More

Print all subarrays with 0 sum in C++

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 361 Views

In this problem, we are given an array of integer values and we have to print all those subarrays from this array that have the sum equal to 0.Let’s take an example to understand the topic better, Input: array = [-5, 0, 2, 3, -3, 4, -1] Output: Subarray with sum 0 is from 1 to 4. Subarray with sum 0 is from 5 to 7 Subarray with sum 0 is from 0 to 7To solve this problem, we will check all subarrays possible. And check if the sum of these subarrays is equal to 0 and print them. This ...

Read More

Print all subsequences of a string using Iterative Method in C++

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 487 Views

In this problem, we are given a string and we have to find the substring from the given string. The substring to be found should start with a vowel and end with constant character.A string is an array of characters.The substring that is to be generated in this problem can be generated by deleting some characters of the string. And without changing the order of the string.Input: ‘abc’ Output: ab, ac, abcTo solve this problem, we will iterate the string and fix vowels and check for the next sequence. Let’s see an algorithm to find a solution −AlgorithmStep 1: Iterate ...

Read More

Fair Candy Swap in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 575 Views

Suppose A and B are two friends. They have candy bars of different sizes. Here A[i] is the size of the i-th bar of candy owned by A, and B[j] is the size of the j-th bar of candy owned by B.Since they are friends, they want to exchange one candy bar each so that after the exchange, both A and B have the same total amount of candy. (The total amount of candy a person has is the sum of the sizes of candy bars they have.) We have to return an integer array suppose ans, where ans[0] is ...

Read More

Add to Array-Form of Integer in Python

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 581 Views

Suppose we have a number in array form. So if the number is say 534, then it is stored like [5, 3, 4]. We have to add another value k with the array form of the number. So the final number will be another array of digits.To solve this, we will follow these steps −Take each number and make them string, then concatenate the stringconvert the string into integer, then add the numberThen convert it into string again, and make an array by taking each digit form the string.ExampleLet us see the following implementation to get better understanding −class Solution(object): ...

Read More

Print all Subsequences of String which Start with Vowel and End with Consonant in C++

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 627 Views

In this problem, we are given a string and we have to find the substring from the given string. The substring to be found should start with a vowel and end with constant character.A string is an array of characters.The substring that is to be generated in this problem can be generated by deleting some characters of the string. And without changing the order of the string.Input: ‘abc’ Output: ab, ac, abcTo solve this problem, we will iterate the string and fix vowels and check for the next sequence. Let’s see an algorithm to find a solution −AlgorithmStep 1: Iterate ...

Read More

Print all paths from a given source to a destination in C++

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 468 Views

In this problem we are given a directed graph and we have to print all paths from the source to the destination of the graph.Directed graph is a graph in with edges that are directed from vertex a to b.Let’s take an example to understand the problem Source = K destination = POutput:K -> T -> Y -> A -> P K -> T -> Y -> P K -> A -> PHere, we have found paths from K to P. We have traversed paths and printed all paths from K that direct us to P.To solve this problem, we will ...

Read More

Hello World using Perl.

Mohd Mohtashim
Mohd Mohtashim
Updated on 11-Mar-2026 1K+ Views

Perl is a programming language developed by Larry Wall, specially designed for text processing.Just to give you a little excitement about Perl, I'm going to give you a small conventional Perl Hello World program,You can try it using the Demo link.Example#!/usr/bin/perl # This will print "Hello, World" print "Hello, world";

Read More

Escaping Characters in Perl

Mohd Mohtashim
Mohd Mohtashim
Updated on 11-Mar-2026 687 Views

Perl uses the backslash (\) character to escape any type of character that might interfere with our code. Let's take one example where we want to print double quote and $ sign −Example#!/usr/bin/perl $result = "This is "number""; print "$result"; print "\$result";OutputThis will produce the following result −This is "number" $result

Read More

Accessing Hash Elements in Perl

Mohd Mohtashim
Mohd Mohtashim
Updated on 11-Mar-2026 405 Views

When accessing individual elements from a hash in Perl, you must prefix the variable with a dollar sign ($) and then append the element key within curly brackets after the name of the variable. For example −Example#!/usr/bin/perl %data = ('John Paul' => 45, 'Lisa' => 30, 'Kumar' => 40); print "$data{'John Paul'}"; print "$data{'Lisa'}"; print "$data{'Kumar'}";OutputThis will produce the following result −45 30 40

Read More
Showing 14241–14250 of 21,090 articles
Advertisements