AYUSH MISHRA has Published 134 Articles

Minimum sum of differences with an element in an array

AYUSH MISHRA

AYUSH MISHRA

Updated on 27-Mar-2025 19:33:41

2K+ Views

Problem Statement In this problem, we are given an array of integers, and we have to select a particular element from the array such that the sum of absolute differences between that element and all other elements is minimized. Example 1 Input: arr = ... Read More

Check if two numbers are coprime using Python

AYUSH MISHRA

AYUSH MISHRA

Updated on 27-Mar-2025 14:42:07

491 Views

In this article, we are going to learn how we can check whether two given numbers are co-prime in Python using different approaches. What are Co-prime Numbers? Two numbers are said to be co-prime numbers if they have no common factors other than 1. Checking if two numbers are co-prime ... Read More

C++ Program to count the number of days in a given month of a year

AYUSH MISHRA

AYUSH MISHRA

Updated on 27-Mar-2025 14:35:49

2K+ Views

There are a total of 365 days in a normal year and 366 days in a leap year. In this article, we are going to learn how we can find the number of days in a month of a given particular year. Here, we will learn about different approaches for ... Read More

JavaScript program to find Number of Squares in an N*N grid

AYUSH MISHRA

AYUSH MISHRA

Updated on 26-Mar-2025 15:02:46

3K+ Views

A grid is a 2-dimensional arrangement of squares divided into rows and columns. From a given N*N square grid we have to calculate the total number of squares possible. There are multiple ways to find the number of squares in a given grid. In this article, we are going to ... Read More

PHP Program to Find the Percentage of a Number

AYUSH MISHRA

AYUSH MISHRA

Updated on 24-Mar-2025 14:12:01

3K+ Views

In this problem, we are given a number and a percentage value, and we have to find the percentage of the given number. In this article, we are going to learn how we can calculate the percentage of a number in PHP using different approaches. Example 1 The percentage of ... Read More

PHP Program to Calculate Simple Interest and Compound Interest

AYUSH MISHRA

AYUSH MISHRA

Updated on 24-Mar-2025 14:06:01

4K+ Views

What is Simple Interest and Compound Interest? Simple Interest is the interest that depends only on the principal amount taken while compound interest is compounded, i.e., previous interest is added in the current time period. In this article, we are going to learn how to calculate simple interest and compound ... Read More

Sorting strings with decimal points in C++

AYUSH MISHRA

AYUSH MISHRA

Updated on 21-Mar-2025 19:01:25

2K+ Views

A string containing decimal points is sorted to solve complex programming problems. This question was asked in the Accenture coding assessment in 2025. In C++, there are different ways to sort such strings efficiently. In this article, we are going to discuss various approaches to sorting strings that contain decimal ... Read More

Sorting an array of binary values - C++

AYUSH MISHRA

AYUSH MISHRA

Updated on 21-Mar-2025 19:00:54

331 Views

Sorting an array of binary values (0s and 1s) is a common problem in programming. In C++, there are multiple ways to efficiently sort an array containing only 0s and 1s. In this article, we are going to learn various approaches to sorting an array of binary values using C++. ... Read More

Python Program for finding nth term of H.P.

AYUSH MISHRA

AYUSH MISHRA

Updated on 20-Mar-2025 13:57:40

1K+ Views

A Harmonic Progression ( H.P.) is a sequence of numbers where the reciprocals of the terms form an Arithmetic Progression (A.P.). In simple terms, if we take the reciprocal of each term in an H.P., the resulting sequence will be in A.P. In this problem, we are given the first ... Read More

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

AYUSH MISHRA

AYUSH MISHRA

Updated on 20-Mar-2025 13:57:21

2K+ Views

Finding a unique number in a list that appears only once while all other numbers appear twice is a common and important problem in programming. We can find the unique number in a list using multiple ways. The most efficient approach is using an XOR operator, as this method solves ... Read More

Advertisements