# Category Archives: PHP Programs

Given n numbers (both +ve and -ve), arranged in a circle, find the maximum sum of consecutive numbers.  Examples:  Input: a[] = {8, -8, 9,… Read More
Given a 2D boolean matrix, the task is to find the number of islands. An island is a group of connected 1s. For example, the… Read More
Given a sorted array of n distinct integers where each integer is in the range from 0 to m-1 and m > n. Find the… Read More
Given an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an element x is the first greater element… Read More
Given a matrix of n X n. The task is to calculate the absolute difference between the sums of its diagonal.Examples:   Input : mat[][] =… Read More
Given an array of integers, and a number ‘sum’, find the number of pairs of integers in the array whose sum is equal to ‘sum’.… Read More
Given two arrays that are duplicates of each other except one element, that is one element from one of the array is missing, we need… Read More
An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array… Read More
Given a Romal numeral, the task is to find its corresponding decimal value. Example :  Input: IX Output: 9 IX is a Roman symbol which… Read More
Given a matrix of n*n size, the task is to find whether all rows are circular rotations of each other or not.  Examples:  Input: mat[][]… Read More
Given a positive integer n which represents the dimensions of a 4n x 4n matrix with values from 1 to n filled from left to… Read More
Given an array arr[] of size n and integer k such that k Output:  Subarray between [3, 5] has minimum average Time Complexity: O(n) Auxiliary Space:… Read More
Given an unsorted array of nonnegative integers, find a continuous subarray which adds to a given number. Examples :  Input: arr[] = {1, 4, 20, 3,… Read More
Given an array of random numbers, Push all the zero’s of a given array to the end of the array. For example, if the given… Read More
Given a sorted array and a value x, the ceiling of x is the smallest element in array greater than or equal to x, and… Read More