Skip to main content

All Questions

3votes
2answers
95views

Optimizing a Function to Check Pronic Numbers in JavaScript

I've written a function in JavaScript to check whether a given number is a Pronic number. A Pronic number, also known as an oblong number, rectangular number, or ...
TAHER El Mehdi's user avatar
4votes
2answers
66views

Optimizing a Function to Generate a Row of Consecutive Odd Numbers in a Triangle

I've written a JavaScript function that generates a row of consecutive odd numbers in a triangle. The triangle looks like this: ...
TAHER El Mehdi's user avatar
0votes
1answer
102views

Advent of Code 2023 day 1: Trebuchet in JS, part 2

The task involves analyzing a bunch of lines containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and combining them ...
konijn's user avatar
2votes
1answer
76views

Advent of Code 2023 day 1: Trebuchet in JS

The task involves analyzing a bunch of lines containing lines of text. Each line represents a calibration value that needs to be recovered by extracting the first and last digits and combining them ...
konijn's user avatar
1vote
1answer
75views

String represents a road. One character travels on the road obeying the stops - Code challenge (advent.js day 5)

This is my code to solve the 5th Adventjs challenge. In that link you can read the instructions. How can I improve it? It's a bit messy... and I'm repeating some part of the code. All must be in just ...
Sofia Chardin's user avatar
3votes
2answers
324views

Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values

Here's a code challenge I got. (I could not solve the challenge, I ran out of time. I rephrased the challenge language and I am trying the challenge again for personal growth & computer science ...
Nate Anderson's user avatar
1vote
2answers
589views

Split the Bill and calculate the Tip

I have created a Bill Splitter page that asks for the total bill amount, tip percentage, and the number of people. Then it displays the tip and the total amount (including the tip) each person has to ...
Ultimate's user avatar
0votes
1answer
132views

Using JavaScript to interface with REST APIs

The website TryHackMe came up with a challenge that involves using HTTP requests to interface with REST APIs (here, task #14/day 9). The challenge basically involves querying a basic REST API to ...
Aleksey's user avatar
1vote
2answers
198views

Implementation of aho corasick algorithm - slow suffix construction

EDIT: Dequeu was the correct guess EDIT: I did the BFS method for the suffix link/output link construction I'm doing a hackerrank challenge and I came up with this implementation of the aho corasick ...
Nicolas Menettrier's user avatar
3votes
1answer
49views

Generate total property sold for given postcode

I had to implement the below as a coding challenge. There are two http endpoints. The first http endpoints returns a list of postcodes. The second http endpoint takes a postcode as a parameter and ...
hulike2286's user avatar
1vote
2answers
1kviews

Leetcode 55. Jump Game solution

I was working on Jump Game problem on leetcode Question You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ...
D_S_X's user avatar
1vote
1answer
228views

JavaScript function that generates Fibonacci like sequences of given order

Generalizations of Fibonacci numbers Fibonacci numbers of higher order A Fibonacci sequence of order \$n\$ is an integer sequence in which each sequence element is the sum of the previous \$n\$ ...
Ξένη Γήινος's user avatar
3votes
1answer
158views

A simple JavaScript function that does prime factorization

This is a simple JavaScript function that does prime factorization. I wrote it on an Android phone with online editor (I don't have access to computers in night time): Code: ...
Ξένη Γήινος's user avatar
2votes
2answers
1kviews

FizzBuzz in JavaScript (node.js), my first JavaScript program

I had just decided to learn JavaScript, so I wrote this program. I am sure you know what FizzBuzz is so I wouldn't describe it here. Console output: ...
Ξένη Γήινος's user avatar
2votes
1answer
257views

Leetcode problem: minimum removal to make valid parentheses

I was working on this problem on leetcode Question Your task is to remove the minimum number of parentheses ( '(' or ')', in any positions ) so that the resulting parentheses string is valid and ...
D_S_X's user avatar

153050per page
close