AYUSH MISHRA

AYUSH MISHRA

112 Articles Published

Articles by AYUSH MISHRA

Page 7 of 12

PHP Program for Binary to Decimal Conversion

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 6K+ Views

Binary to decimal conversion is the process of converting a binary number (base-2 number using only 0s and 1s) into its equivalent decimal number (base-10 form). In this article, we will learn how to convert binary numbers to decimal form in PHP using different approaches. How Binary to Decimal Conversion Works To convert a binary number to decimal, multiply each binary digit by 2 raised to the power of its position (starting from 0 on the right), then sum all results ? Binary to Decimal Conversion: 1011 Position: ...

Read More

PHP Program to Count Vowels in a String

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 8K+ Views

A string is a sequence of characters, including alphabets, numbers, and symbols. In this tutorial, we are going to learn how we can count the number of vowels in a given string in PHP using different approaches. Vowels in English are a, e, i, o, u, and they can be either uppercase or lowercase. What is a Vowel? Vowels are alphabetic characters that represent specific speech sounds. There are a total of five vowels, both uppercase and lowercase in the English language: a, e, i, o, u A, E, I, O, U Example 1 ...

Read More

How to Check If Two Arrays are Equal in PHP?

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 6K+ Views

When working with arrays in PHP, you often need to compare them to check if they contain the same elements. Array equality can mean different things − same elements in same order, same elements regardless of order, or strict type matching. This article explores different approaches to check if two arrays are equal in PHP. Using the == Operator The == operator provides a loose comparison, checking if arrays have the same elements in the same order without strict type checking ? The arrays are equal Using the === Operator ...

Read More

PHP program to find the perimeter of rectangle

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 7K+ Views

A rectangle is a closed two-dimensional figure with 4 sides where opposite sides are equal and parallel. The perimeter is the total distance around the rectangle, calculated by adding all four sides. In this tutorial, we'll learn different PHP approaches to calculate rectangle perimeter. Length Breadth Length Breadth Formula The formula for calculating rectangle perimeter is − Perimeter = 2 × (Length + Breadth) Where length is the horizontal distance and breadth is the vertical distance. Direct Formula Approach The ...

Read More

PHP Program to Check if a Number is an Armstrong Number

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 5K+ Views

An Armstrong number is a number in which the sum of its digits raised to the power of the number of digits is equal to the number itself. In this article, we will discuss how to check if a given number is an Armstrong number using PHP. Examples Let's understand Armstrong numbers with some examples ? Example 1: 9474 This is a four-digit number with digits 9, 4, 7, and 4. 9474 = 9⁴ + 4⁴ + 7⁴ + 4⁴ = 6561 + 256 + 2401 + 256 ...

Read More

How to Add Elements to the End of an Array in PHP

PHP
AYUSH MISHRA
AYUSH MISHRA
Updated on 15-Mar-2026 9K+ Views

Arrays are linear data structures used to handle data in programming. Sometimes while dealing with arrays we need to add new elements to an existing array. In this article, we will discuss several methods to add elements to the end of an array in PHP, complete with code examples and outputs. Following are different approaches to adding elements to an array − Using Square Brackets [] The simplest way to add an element to the end of an array in PHP is by using square brackets []. This syntax is suitable when you want to add only ...

Read More

Find the number that appears once, and the other numbers twice in Java

AYUSH MISHRA
AYUSH MISHRA
Updated on 30-Apr-2025 5K+ Views

In this problem, we are given an array of integers. In the given array, each element occurs two times except one element, which occurs only once. We have to find the number that appears only once. In this article, we are going to learn how we can find the number that appears once, and all other numbers appear twice in Java. Scenario 1 All other numbers except 4 occur twice, so 4 is the only number that appears only once. Input: [ 1, 2, 3, 3, 2, 4, 1, 5, 5] Output: 4 Scenario 2 All other numbers except ...

Read More

C++ Program to Rotate Array Left by One Position

C++
AYUSH MISHRA
AYUSH MISHRA
Updated on 30-Apr-2025 9K+ Views

Rotating an array means shifting the elements of an array in a specific direction while maintaining their relative order. For example, if the array {6, 12, 18, 24, 30} is rotating it left once will result in {12, 18, 24, 30, 6}. In this article, we are given an array and need to shift all elements one step to the left, with the first element moving to the last position. Example Here is an example of left rotation of elements in array by one place. Input: array = {5, 10, 15, 20, 25} Output: array = {10, 15, ...

Read More

C++ Program to Find Sum of Leaf Node in Binary Tree

C++
AYUSH MISHRA
AYUSH MISHRA
Updated on 28-Apr-2025 5K+ Views

We can find the sum of leaf nodes in a binary tree using an iterative and a recursive approach. This problem has many real-life applications, such as analyzing hierarchies, calculating final results in decision trees, or summing final nodes in various kinds of trees used in computer algorithms. In this article, we are going to learn how can find the sum of all leaf nodes in a binary tree in the C++ language. What are Leaf Nodes in a Binary Tree? The leaf nodes of a binary tree are the nodes that do not have any children. Both the ...

Read More

Kth largest Element in a 2D matrix where each row and column is sorted in C++

C++
AYUSH MISHRA
AYUSH MISHRA
Updated on 24-Apr-2025 953 Views

Finding the Kth largest element in a 2D matrix where each row and column is sorted is a common problem in computer science. This problem has many real-life applications, such as a ranking system, where we need to find the Kth highest score in a sorted dataset. In this article, we are going to discuss how we can find the Kth largest element in a 2D matrix e where each row and column is in sorted order in the C++ language. What is the Kth Largest Element? The Kth largest element refers to an element that is placed at ...

Read More
Showing 61–70 of 112 articles
« Prev 1 5 6 7 8 9 12 Next »
Advertisements