Skip to main content

All Questions

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
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
5votes
1answer
299views

Container with most water

The task is taken from leetcode Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of ...
thadeuszlay'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
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
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 ...
thadeuszlay's user avatar
3votes
3answers
823views

Rotate a linked list to the right by k places

The task Given a linked list and a positive integer k, rotate the list to the right by k places. For example, given the linked list 7 -> 7 -> 3 -> 5 and k = 2, it should become 3 -> 5 -> 7 -...
thadeuszlay's user avatar
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/...
thadeuszlay's user avatar
1vote
2answers
245views

First Unique Character in a String

The task is taken from leetcode Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return ...
thadeuszlay's user avatar
1vote
1answer
113views

Advent of Code 2017 Day 2 (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 - i.e. Day 2: Corruption Checksum (below is the 1st part ...
thadeuszlay's user avatar

close