Found 9321 Articles for Object Oriented Programming

Finding all the Longest Strings from an Array in JavaScript

Nikitasha Shrivastava
Updated on 14-Aug-2023 17:36:07

543 Views

In the given problem statement we have to find all the longest strings from an array with the help of Javascript functionalities. So basically this task can be done by getting the length of each string and then comparing these lengths with the maximum length. Understanding the Problem The problem at hand is to find the longest strings from an array in Javascript. So we will have an array of strings and our main task is to identify the strings which have the maximum length and show them as a new array. For example: suppose we have an ... Read More

JavaScript: Adjacent Elements Product Algorithm

Nikitasha Shrivastava
Updated on 14-Aug-2023 18:35:54

557 Views

In the given problem statement we have to calculate the adjacent elements product with the help of Javascript functionalities. So we will use a loop and basic mathematical operations to solve this problem. Understanding the problem The problem statement at hand is to calculate the product of two adjacent elements and the product should be maximum in the array. So basically the algorithm involves the maximum product of two adjacent items in the array. This functionality is commonly used in various cases like finding the maximum profit or solving the mathematical puzzles. The example of the ... Read More

Absolute Values Sum Minimization in JavaScript

Nikitasha Shrivastava
Updated on 11-Aug-2023 16:42:09

402 Views

In the given problem statement we have to find the absolute value for minimization of the sum in the given array with the help of Javascript functionalities. So we will use basic mathematics for solving the problem. Understanding the problem The problem at hand is to find the absolute values for minimization of the sum. This is the basic problem to solve in mathematics and computer science. This program involves finding a number from the given array which minimizes the sum of the absolute difference between that number and the other item in the array. Logic ... Read More

Sum of even Fibonacci terms in JavaScript

Nikitasha Shrivastava
Updated on 16-Aug-2023 17:02:26

374 Views

In the given problem statement we have to calculate the sum of even fibonacci numbers with the help of Javascript functionalities. So for solving this task we will use basic functionalities of the language. Understanding the Problem The problem at hand is to calculate the sum of even fibonacci numbers or items up to the given limit of the fibonacci number. As you may know, the fibonacci sequence is a series of numbers in which every number is the sum of the two previous numbers. The series usually starts from 0 and 1. So in this problem our ... Read More

Finding sum of multiples in JavaScript

Nikitasha Shrivastava
Updated on 14-Aug-2023 17:39:01

2K+ Views

In the given problem statement we have to find the sum of the multiples of the given input number within the given range with the help of Javascript functionalities. So we will use a loop to iterate through the numbers from the starting range to the ending range. Understanding the Problem The problem at hand is to find the sum of multiples of the given number in the given range. So in this problem we have to calculate the sum of all the numbers that are divisible by the given number. For example: suppose we have a ... Read More

Sort an integer array, keeping first in place in JavaScript

Nikitasha Shrivastava
Updated on 16-Aug-2023 16:53:58

92 Views

In the given problem statement we have to sort the given integer array but we have to keep the first item in place and sort the remaining items with the help of Javascript functionalities. So we will use some predefined functions of Javascript to solve the problem. Understanding the Problem The problem at hand is to get the sorted array of integer numbers in Javascript and the main operation in this task is to keep the first item intact in its original position. Or we can say we have to rearrange the items in the array so that ... Read More

Find the Exact Individual Count of Array of String in Array of Sentences in JavaScript

Nikitasha Shrivastava
Updated on 14-Aug-2023 17:14:18

206 Views

In the given problem statement we have to find the exact individual count of the array of strings in the array of sentences with the help of Javascript functionalities. So we will solve using the for loops to get the required result. Understanding the Problem The problem at hand is to find the exact individual count for each string in an array of sentences with the help of Javascript. We will be given an array or string and an array of sentences. So we have to find out how many times every string is appearing in the given ... Read More

Sum of all prime numbers in JavaScript

Nikitasha Shrivastava
Updated on 16-Aug-2023 17:00:15

2K+ Views

In the given problem statement we have to compute the sum of all the prime numbers with the help of Javascript functionalities. So for calculating the sum we will set the upper limit of primes numbers. Understanding the Problem The problem is to calculate the sum of all the prime numbers up to a given limit. So the prime number is a positive integer which is greater than 1 and also these numbers do not have any divisors other than 1 and itself. For example we have a limit of the primes is 10, so the prime numbers ... Read More

Finding the smallest multiple in JavaScript

Nikitasha Shrivastava
Updated on 14-Aug-2023 17:51:05

317 Views

In the given problem statement we have to find the smallest multiple of the given numbers with the help of Javascript functionalities. So we will use loops to iterate through and check the multiples of the given numbers. Understanding the Problem The problem at hand is to find the smallest multiple of the given number in Javascript. The multiple of a number is a number that can be divided evenly by that number. To solve the problem we will use a loop and iterate over the numbers until we find the smallest multiple which is divisible by all ... Read More

Parse and balance angle brackets problem in JavaScript

Nikitasha Shrivastava
Updated on 16-Aug-2023 12:52:47

808 Views

In the given problem statement we have to find whether the angle brackets in the code are balanced or not with the help of Javascript functionalities. So for solving this problem we will use a stack based approach using Javascript methods. What is a Stack-based Approach ? The stack-based approach is an algorithmic technique which involves using a data structure called stack. So the stack is a collection of items which supports two main operations: push and pop. Push operation adds an item to the top of the stack and pop removes the top item from the stack. ... Read More

Advertisements