Found 27104 Articles for Server Side Programming

Minimum sum of multiplications of n numbers

Vaishnavi Tripathi
Updated on 05-Oct-2023 11:46:23

75 Views

In this article, we will discuss two approaches to generate the desired sum. Both the approaches are dynamic programming-based approaches. In the first approach, we will memorization for dynamic programming and then we will apply the same approach for tabulation in order to avoid the use of extra stack space for recursion. Problem Statement We are given a list of n integers, and our goal is to minimize the sum of multiplications by repeatedly taking two adjacent numbers, summing them modulo 100, and replacing them in the list until only one number remains. Let's consider the input [30, 40, 50] ... Read More

Minimum number of subtract operation to make an array decreasing

Vaishnavi Tripathi
Updated on 05-Oct-2023 11:44:55

96 Views

In this article, we will work upon sorting an array in decreasing order by applying some subtraction operations on it. Problem Statement We are given an array containing a series of n numbers from array[0], array[1], . . . . , array[ n-1 ]. We are also given an integer nums. Our task is to generate a decreasing array by subtracting nums from the array elements in every operation. We need to return the least possible number of such operations required in order to make the array decreasing in order. Let us understand the problem with an example − ... Read More

Maximum in array which is at-least twice of other elements

Vaishnavi Tripathi
Updated on 05-Oct-2023 11:42:11

59 Views

In this article, we will discuss different approaches to point out the greatest element in the array which is at least twice of all the other elements in the same array. Problem Statement An array of n different elements is given to us, we have to find out the maximum element in the given array "nums" such that it is either greater than or equal to twice of all the other elements in that array. In other words, we can also say the we have to find out whether or not all the other elements of the given array are ... Read More

Largest number that is not a perfect square

Vaishnavi Tripathi
Updated on 05-Oct-2023 11:34:32

91 Views

In this article, we will discuss two different approaches to find out the largest number smaller than a given number which is not a perfect square. In the first approach, we will run a loop to check for every number until we find the desired number while in the second approach, we will use the concept of square root to generate the perfect square number just smaller than the given number and based on this, we will find out the largest number smaller than "nums" which is not a perfect square. Let us first understand the problem statement. Problem Statement ... Read More

k smallest elements in same order using O(1) extra space

Vaishnavi Tripathi
Updated on 05-Oct-2023 11:32:10

60 Views

We have an array "nums" consisting of "size" elements and an integer "number" denoting the number of smallest elements we have to return. Our task is to find out the "number" smallest elements from the given array. The order of the elements should be preserved and we are not allowed to use any extra variable space for the solution i.e., the space complexity of the solution should be O(1). Let us understand this using an example, nums = { 4, 2, 6, 5, 1 } The solution should return 4, 2, 5 as they are the smallest 3 ... Read More

Factorial of each element in Fibonacci series

Vaishnavi Tripathi
Updated on 09-Feb-2024 16:31:32

244 Views

In this article, we will discuss a simple program which calculates the factorial of all the numbers present in the Fibonacci series smaller than a given nums. Problem Statement We are given a number and our task is to generate the factorial of all the numbers present in the Fibonacci series and smaller than the given number. Let us first understand the problem statement and requirements from the code solution with the help of examples. Input nums = 13 Output Fibonacci series up to 13 is 0, 1, 1, 2, 3, 5, So, the factorial ... Read More

Statistical Simulation in Python

Pranay Arora
Updated on 04-Oct-2023 15:08:37

325 Views

Statistical simulation is the task of making use of computer based methods in order to generate random samples from a probability distribution so that we can model and analyse complex systems which exhibit random behaviour. In this article we are going to see how to make use of this powerful tool in Python to make predictions, generate insights as well as evaluate the performance of statistical algorithms. There are different types of statistical simulations, which are as follows: Monte Carlo simulations − Generation of random samples from a probability distribution in order to estimate the expected value of a ... Read More

Network Analysis in Python

Pranay Arora
Updated on 04-Oct-2023 14:47:51

302 Views

A network is a collection of nodes and edges that represent the relationships or connections between those nodes. The nodes can represent various entities, such as individuals, organizations, genes, or websites, while the edges represent the connections or interactions between them. Network analysis is the study of the relationships between these entities are node represented as a network. In this article, we are going to see how to implement network analysis using python. It involves the use of many mathematical, statistical and computational techniques. Network analysis can provide insights into the behaviour of complex systems and help to make ... Read More

Introduction to Financial Concepts using Python

Pranay Arora
Updated on 04-Oct-2023 14:37:17

84 Views

Python provides us with a variety of tools as well as libraries that help us work with the foundations of probability. Probability has a wide scale use case from AI content detection to card games. The random module is often used for probability related problem statements. This combined with libraries like numpy and scipy (and matplotlib and seaborn for visualization) can be of great advantage when the data is large scale and mainly in the form of csv files. Probability problem statements can further be clubbed with statistics to gain more insights. It doesn’t matter if you are a beginner ... Read More

Foundations of Probability in Python

Pranay Arora
Updated on 04-Oct-2023 14:27:50

364 Views

Probability deals with the study of random events as well as their outcomes. It is an essential concept in various fields like finance, physics, engineering and data science. It is defined as the likelihood of an event occurring as no event can be predicted with 100% certainty. Hence probability is just a guide. In this article, we are going to be seeing the foundations of probability in Python. Python offers a number of libraries that allow us to work with probability distributions and perform statistical computations as well as generate random numbers. The basic concepts and keywords of probability ... Read More

Advertisements