-

Three Sessions: Taking My Five-Year-Old Kiteboarding
Body drag, ride, jump. How I took Aiden from the beach to a tandem kite jump in three sessions — what each one was for, and what I’d tell another parent.
-
Coding algorithm helper
Tree Traversals. Depth-first: Inorder, pre-order, post-order. Bread-first.
-
Surrounding regions using flash flood algorithm
Set all of the O to – across the board For each side find adjacent – and change them to Os using flash flood algorithm Change all of the remaining – to X The complexity of the above solution is O(m*n)
-
Dynamic Programming
A list of problems that will let you learn dynamic programming Maximum Subarray Can be solved with Kadane algorithm Maximum Product Subarray Instead of using one variable to store the max we can use two variables to store max and min and flip them whenever…
-
Find Peak Element with JS
A peak element is an element that is strictly greater than its neighbors. Given an integer array nums, find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks. You may imagine that nums[-1] = nums[n] = -∞.…
-
Reduce Array Size to The Half with JS solved using dictionary
Given an array arr. You can choose a set of integers and remove all the occurrences of these integers in the array. Return the minimum size of the set so that at least half of the integers of the array are removed. Solution iterate over an array and store the…
-
Lowest Common Ancestor in a Binary Tree LeetCode problem in JS solved with comparing vector path to each node
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has…
-
MyCalendar LeetCode problem in JS solved with double arrays
Problem defenition Implement a MyCalendar class to store your events. A new event can be added if adding the event will not cause a double booking. Your class will have the method, book(int start, int end). Formally, this represents a booking on the half open interval [start, end), the…
-
Sparse Arrays – Hackerrank medium problem in JS solved using HashMap
https://www.hackerrank.com/challenges/sparse-arrays/problem The idea is to iterate over input data and put it into HashMap with keys being available strings and values being the number of times this string is present in the input. Time complexity is O(n) and space complexity O(n)
-
Moving boxes to one spot – Leetcode coding problem (Medium)
Another fun problem that was pretty easy solve is moving boxes to one spot: https://leetcode.com/problems/minimum-number-of-operations-to-move-all-balls-to-each-box/ It can be solved by iterating over an array and summing difference in distance between elements. Solution in Javascript: