Skip to content

Category Archives: PHP Programs

Given a binary array sorted in non-increasing order, count the number of 1’s in it.  Examples:  Input: arr[] = {1, 1, 0, 0, 0, 0,… Read More
Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example :  Input : arr[] = [1, 2, 3, 4, 5,… Read More
Write a program to print all the LEADERS in the array. An element is leader if it is greater than all the elements to its… Read More
Given a sorted array of positive integers, rearrange the array alternately i.e first element should be the maximum value, second minimum value, third-second max, fourth-second… Read More
Given an array arr[0 … n-1] containing n positive integers, a subsequence of arr[] is called Bitonic if it is first increasing, then decreasing. Write… Read More
Given a 2D binary matrix of N rows and M columns. The task is to check whether the matrix is horizontal symmetric, vertical symmetric, or… Read More
Given an array where every element occurs three times, except one element which occurs only once. Find the element that occurs once. Expected time complexity… Read More
Given an array of n integers where each value represents the number of chocolates in a packet. Each packet can have a variable number of… Read More
Given an array of n integers, find the third largest element. All the elements in the array are distinct integers. Example :   Input: arr[] = {1,… Read More
Given an array arr[] of size n. Three elements arr[i], arr[j] and arr[k] form an inversion of size 3 if a[i] > a[j] >a[k] and… Read More
Given an array, only rotation operation is allowed on array. We can rotate the array as many times as we want. Return the maximum possible… Read More
Inversion Count for an array indicates – how far (or close) the array is from being sorted. If the array is already sorted, then the… Read More
Given a string s1 and a string s2, write a snippet to say whether s2 is a rotation of s1? (eg given s1 = ABCD… Read More
In this article, we will see how to generate a random password using the given string. We have given a string and the task is… Read More
In this article, we learn how to find the length of the string in PHP.  Approach: This task can be done by using the built-in… Read More

Start Your Coding Journey Now!