life is too short for a diary



Posts Tagged: javascript

Getting started with Javascript Promises and Async Await

Getting started with Javascript Promises and Async Await..

Continue reading → javascript



Why Math.max() is Less Than Math.min() in JavaScript

JavaScript is full of surprises and unexpected behaviors that often leave developers scratching their heads. One of those strange behaviors is the fact that Math.max() < Math.min() is true in JavaScript. In this blog, we'll delve into the underlying reasons for this seemingly paradoxical result...

Continue reading → javascript



House Robber Leetcode Solution

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night...

Continue reading → javascript java python rust



Kata - Correct the Time String

In this [kata](https://www.codewars.com/kata/57873ab5e55533a2890000c7/), you are given a string that represents a time in the format "HH:MM:SS". The string may be in the wrong format, or it may be missing some characters. Your task is to correct the string so that it represents a valid time...

Continue reading → java javascript



Remove-all-adjacent-duplicates-in-string-ii Solution

You are given a string s and an integer k, a k duplicate removal consists of choosing k adjacent and equal letters from s and removing them, causing the left and the right side of the deleted substring to concatenate together...

Continue reading → leetcode stack python java scala javascript



Lowest Common Ancestor of a Binary Tree

Questions involving the binary tree data structure are very popular in tech interviews, and can be challenging and varied! A binary tree is a data structure consisting of a collection of nodes (starting at a root node), where each node consists of a value (data), together with a directed edges to at most two nodes (the "left child" and "right child"), with the additional conditions that no two edges point to the same node and no edge points to the root. I recently solved an interesting problem on binary tree...

Continue reading → leetcode java python javascript scala