All Questions
27 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 ...
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: ...
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: ...
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 ...
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 ...
4votes
2answers
324views
square the elements of a sorted list and give the output in sorted order
Given a sorted list of integers, square the elements and give the output in sorted order. For example, given [-9, -2, 0, 2, 3], return [0, 4, 4, 9, 81]. My solution 1: ...
4votes
1answer
114views
Advent Of Code 2017 Day 4 (part 1) in Functional Programming (FP)
I wanted to practice functional programming (fp) without using any library but using vanilla JS only. So I took a problem from Advent of Code (the 1st part of Day 4): A new system policy has been ...
3votes
4answers
1kviews
Finding the max sequence finder
Problem Statement Find the max sequence finder. findMaxSequence([3, 2, 3, 4, 2, 2, 4]); ...
3votes
2answers
898views
Robot Return to Origin
The task is taken from leetcode There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes ...
3votes
2answers
8kviews
Given a set of closed intervals, find the smallest set of numbers that covers all the intervals
The Task: Given a set of closed intervals, find the smallest set of numbers that covers all the intervals. If there are multiple smallest sets, return any of them. For example, given the ...
3votes
0answers
114views
Advent of Code 2017 Day 3 (part 1) in Functional Programming (FP)
I wanted to practice functional programming (FP) without using any library but using vanilla JS only. So I took a problem from Advent of Code. https://adventofcode.com/2017/day/3 You come across an ...
2votes
1answer
757views
Given time intervals determine if a person could attend all meetings
The task is taken from LeetCode Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] ...
2votes
1answer
2kviews
Find common characters (LeetCode)
The task is taken from leetcode Given an array A of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including duplicates). ...
2votes
1answer
165views
Advent of Code 2017 Day 6 (part 1) in Functional Programming (FP)
I wanted to practice functional programming (FP) without using any library but using vanilla JS only. So I took a problem from Advent of Code (the 1st part of Day 6): http://adventofcode.com/2017/day/...
2votes
1answer
105views
Advent of Code 2017 Day 5 (part 1) in Functional Programming (FP)
I wanted to practice functional programming (FP) without using any library but using vanilla JS only. So I took a problem from Advent of Code (the 1st part of Day 5): An urgent interrupt arrives ...