# Category Archives: PHP Programs

You are given an array on n-elements. An extrema is an elements which is either greater than its both of neighbors or less than its… Read More
Given an integer n, the task is to generate all the left shift numbers possible. A left shift number is a number that is generated… Read More
We have a sorted array with duplicate elements and we have to find the index of last duplicate element and print index of it and… Read More
Given a matrix of order m*n then the task is to find the frequency of even and odd numbers in matrix Examples:   Input : m =… Read More
Write code to find lexicographic minimum in a circular array, e.g. for the array BCABDADAB, the lexicographic minimum is ABBCABDADInput Constraint: 1 < n <… Read More
Given an array A[] consisting 0s, 1s and 2s. The task is to write a function that sorts the given array. The functions should put… Read More
Given a matrix, clockwise rotate elements in it. Examples: Input 1 2 3 4 5 6 7 8 9 Output: 4 1 2 7 5… Read More
Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1,… Read More
Given a large positive number as string, count all rotations of the given number which are divisible by 4.  Examples:  Input: 8 Output: 1 Input:… Read More
Given an array arr[] of n integers, find the maximum that maximizes the sum of the value of i*arr[i] where i varies from 0 to… Read More
Given an unsorted array and a number n, find if there exists a pair of elements in the array whose difference is n. Examples:   Input: arr[]… Read More
Given an array, cyclically rotate the array clockwise by one. Examples: Input: arr[] = {1, 2, 3, 4, 5} Output: arr[] = {5, 1, 2,… Read More
Given two matrices, the task to multiply them. Matrices can either be square or rectangular. Examples:  Input : mat1[][] = {{1, 2}, {3, 4}} mat2[][]… Read More
Given an array of n non-negative integers. The task is to find frequency of a particular element in the arbitrary range of array[]. The range… Read More
Given an array of numbers, arrange them in a way that yields the largest value. For example, if the given numbers are {54, 546, 548,… Read More