Nikitasha Shrivastava

Nikitasha Shrivastava

163 Articles Published

Articles by Nikitasha Shrivastava

163 articles

JavaScript: Adjacent Elements Product Algorithm

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 22-Jan-2025 920 Views

In this article, we will learn to calculate the adjacent elements product with the help of Javascript functionalities. This problem is often asked in coding interviews or algorithm challenges, and it tests one's understanding of array manipulation and performance optimization. Problem Statement Given an array of integers, your task is to return the largest product that can be obtained by multiplying any two adjacent numbers in the array. For example − Input [5, 1, 2, 3, 1] Output 6 The adjacent elements are (5, 1), (1, 2), (2, 3), and (3, 1). The largest product is 6 (from 2 * ...

Read More

JavaScript - Find if string is a palindrome (Check for punctuation)

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 13-Dec-2024 948 Views

In the given problem statement we have to find that the string is a palindrome and the string should also have punctuation and write code with the help of Javascript functionalities. Here we will learn two methods to determine if a string is a palindrome in JavaScript while handling punctuation and spaces effectively. What is a Palindrome? A palindrome is not limited to single words like "radar" or "level"; it can include phrases or sequences like "Madam, in Eden, I’m Adam." We need to ignore punctuation, spaces, and case differences to ensure accurate palindrome checks.   Using JavaScript String and Array ...

Read More

JavaScript Sum odd indexed and even indexed elements separately and return their absolute difference

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 30-Sep-2024 1K+ Views

For a given list of elements, write a JavaScript program to find the sum of its odd and even indexed elements and then, calculate difference between them. To solve this problem, we will first separate odd indexed and even indexed elements. After separating them find their sum separately and store it in different variables. Now, we will calculate the difference between these sums to get desired result. Example Scenario: Input: list = [11, 21, 31, 41, 51, 61]; Output: difference = 30 Here, odd-indexed items are [21, 41, 61] and their sum is 123. The even-indexed items are ...

Read More

JavaScript Group a JSON Object by Two Properties and Count

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 27-Jun-2024 3K+ Views

The problem stated that we have to add two properties of the JSON object and count its occurrences. For example we have name and age properties in JSON then group them in a single property and count their occurrences. What is JSON? JSON (Javascript Object Notation) is lightweight data to transfer between devices. It is human readable and writable data. JSON is in the form of key-value pairs. Keys are strings to define values. In JSON each entry is separated by a semicolon. For example - {“name” : “Peter”}, in this example name is a key and Peter ...

Read More

Show Normal Inverse Gaussian Distribution in Statistics using Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-Oct-2023 426 Views

In this article we will be discussing the Normal inverse Gaussian distribution and also discuss how to implement and show this distribution using Python. Understanding the Problem The Normal Inverse Gaussian distribution in statistics is the probability distribution which can be used in various fields like finance, risk management and statistical analysis. So we will discuss the logic behind this distribution to implement in Python. Logic for The Above Problem The normal-inverse Gaussian distribution (NIG), a continuous probability distribution, is characterized as the normal variance-mean mixture with the inverse Gaussian distribution as the mixing density. To plot and show the ...

Read More

Show Normal Distribution in Statistics using Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-Oct-2023 470 Views

In the problem statement we are required to show the normal distribution using Python and its libraries. In the tutorial we will discuss what is normal distribution and how it can be plotted using Python. What is Normal Distribution in Statistics? In the statistics, Normal Distribution is a popular probability distribution. It frequently serves as a model for naturally occurring occurrences and it has a bell-shaped curve as its different feature. It is also known as Gaussian distribution. We can create random data points that fit the normal distribution using a random function in Python to display the ND. Following ...

Read More

Show Non-Central F-Distribution in Statistics using Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-Oct-2023 237 Views

In the given problem we have to show the non-central F-distribution with the help of Python and its libraries. So we will explore what non-central F-distribution is and how to show it using Python. Understanding the Non-Central F-Distribution The Non-Central F-Distribution is a probability distribution in statistics which is basically used for analyzing variance in the given data. It uses the central F-distribution by using the non-centrality parameters which are used to make deviation. The non-central F-distribution used to determine the probability of observing a particular statistics. The figure of this distribution is generated using the degrees of freedom with ...

Read More

Show Non-Central Chi-squared Distribution in Statistics using Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-Oct-2023 273 Views

In the given problem statement we are required to show the Non-central Chi-squared distribution with the help of Python. So we will be using Python libraries to show the required result. Understanding the Non-Central Chi-squared Distribution The distribution called non-central chi-squared is a probability distribution in statistics. This distribution is mainly used in power analysis. It is a generalization of chi-squared distribution. It can be obtained by summing up the squares of standard normal random variables. In this the shape of the distribution is defined by the degrees of freedom. It incorporates a non-centrality parameter. This parameter shows the presence ...

Read More

Show Nakagami Distribution in Statistics using Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-Oct-2023 249 Views

In the given problem statement we have to create an algorithm to show the Nakagami Distribution in Statistics with the help of Python and its libraries. So in this article we will use matplotlib, numpy and scipy libraries of Python to solve the given problem. What is Nakagami Distribution in Statistics? The Nakagami distribution is basically a probability distribution. It consists of parameters, a sample dataset and a model description for probability distribution. This distribution is mainly used in communication to model signals which reach the receiver with the help of several paths. Understanding the Logic for the Problem The ...

Read More

Show Negative Binomial Discrete Distribution in Statistics using Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-Oct-2023 275 Views

In this problem statement we have to show the negative binomial discrete distribution in statistics with the help of Python. So for showing this statistic we will be using the numpy and matplotlib libraries of Python. What is Negative Binomial Discrete Distribution? In statistics, the Negative Binomial distribution represents the number of trials required to get the number of failures. In this the trial can result in success or failure. So we can say that the number of failures occurs before the number of successes is achieved in the trials. It is related to the geometric distribution. The Negative Binomial ...

Read More
Showing 1–10 of 163 articles
« Prev 1 2 3 4 5 17 Next »
Advertisements