-
[Leetcode] 217. Contains Duplicate
Problem Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Example 1: Input: nums = [1,2,3,1] Output: true Example 2: Input: nums = [1,2,3,4] Output: false Example 3: Input: nums = [1,1,1,3,3,4,3,2,4,2] Output: true Constraints: Explanation The simplest approach involves iterating twice through the array to…
-
[Javascript] Closure
What is a Closure? In simple terms, an inner function captures the context of the outer function. But, what is a context? The context refers to the environment in which a function is declared. This environment includes any variables, parameters, and functions that are within the scope of the function when it is defined. When…
-
[Javascript] Controlling code flow (3)
try, catch, and finally When we try to handle errors, try-catch statement is a good option. However, it isn’t clear how the error is caught in catch block. Furthermore, it is trickier when finally block is included. We do know that finally block must be executed after try and catch block, but the code flow…
-
[Javascript] Controlling code flow (2)
Labeled Statement Labeled statements in JavaScript provide a mechanism for identifying and referencing specific statements within your code. While not frequently used, they can be particularly useful in certain scenarios, such as when working with nested loops or when you need to break out of multiple control structures. Why Do We Need Labels? Labels are…
-
[Javascript] Controlling code flow (1)
Controlling code flow Conditional statement When controlling the flow of our code, we have several options. If we want to execute different blocks of code based on certain conditions, we can use if-else statement. These statements allow us to specify which code block should be executed based on carefully defined conditions. Below, we see see…
-
Third Quarter Roadmap
Docker & K8S (Coming in July) When I first joined the company, my initial task was to set up a Kubernetes (K8S) cluster for the company’s services. It was a challenging, demanding, and exhausting experience, but ultimately very rewarding. I will share the details of what I accomplished and provide a guide on how to…