Skip to main content

All Questions

10votes
2answers
696views

Array duplicate removal for duplicates exceeding `N`-number

I recently encountered a front-end interview coding challenge question that required one to create a function which returned an array that excluded numbers that occurred more than ...
Gavin Hughes's user avatar
8votes
5answers
1kviews

Expanding powers of expressions of the form ax+b

I solved the following problem: Write a function expand that takes in an expression with a single, one character variable, and expands it. The expression is in the form ...
haxor's user avatar
8votes
3answers
1kviews

HackerRank "Ransom Note" challenge

I have solved the Ransom Note challenge on HackerRank using JavaScript / ECMAScript 6. The challenge goes like this: A kidnapper wrote a ransom note but is worried it will be traced back to him. He ...
Phrancis's user avatar
8votes
1answer
2kviews

Merge Intervals in JavaScript

This is a task taken from Leetcode - Given a collection of intervals, merge all overlapping intervals. Example 1: ...
thadeuszlay's user avatar
7votes
1answer
4kviews

Given a string containing just parentheses, determine if the input string is valid

The task is taken from leetcode Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: ...
thadeuszlay's user avatar
7votes
1answer
1kviews

Code Challenge: Catching Car Mileage Numbers - 4 kyu Kata from CodeWars

Challenge Story: "7777...8?!??!", exclaimed Bob, "I missed it again! Argh!" Every time there's an interesting number coming up, he notices and then promptly forgets. Who doesn't like catching ...
user166286's user avatar
6votes
4answers
3kviews

Find all letter Combinations of a Phone Number

The task is taken from LeetCode Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just ...
thadeuszlay's user avatar
6votes
2answers
164views

Starship Comparison App with ES6 Generators and the Star Wars API

Assignment Description: Make a web application that compares starships based upon the Star Wars API. There shall be: A label "Select two Starships from the dropdown lists to compare". Two dropdown-...
michael.zech's user avatar
5votes
3answers
3kviews

Reverse Integer

The task is taken from leetcode Given a 32-bit signed integer, reverse digits of an integer. Example 1: Input: 123 Output: 321 Example 2: ...
thadeuszlay's user avatar
5votes
3answers
2kviews

Determine whether an integer is a palindrome

The task Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: ...
thadeuszlay's user avatar
5votes
2answers
938views

Create a min stack

The task is taken from leetcode Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Removes ...
thadeuszlay's user avatar
5votes
2answers
2kviews

Process strings of operations

This was the task (I don't know the exact wordings anymore): You get a string with operation as input: if it is a number push it to stack if it is "DUP", then duplicate the one one top and ...
thadeuszlay's user avatar
5votes
2answers
520views

Frequency Queries (Hackerrank)

This is the problem: You are given queries. Each query is of the form two integers described below: 1 x: Insert x in your data structure. 2 y: Delete one occurrence of y from your data ...
daksh bhardwaj's user avatar
5votes
1answer
323views

Find the starting indices of all occurrences of the pattern in the string - KMP algorithm follow-up

The task was initially solved here, but was too buggy: Given a string and a pattern, find the starting indices of all occurrences of the pattern in the string. For example, given the string "...
thadeuszlay's user avatar
5votes
1answer
119views

Advent Of Code 2017 Day 4 (part 2) in Functional Programming (FP)

I wanted to practice functional programming (FP) without using any library but using vanilla JavaScript only. So I took a problem from Advent of Code (the 2nd part of Day 4) You can only access the ...
thadeuszlay's user avatar

153050per page
close