Skip to content

LeetCode

To Be Or Not To Be – 2704

πŸ”—LC2704 🟒 Easy 🧩 Pattern – Closures πŸ“… Day 3/30 Days of JavaScript Write a function expect that helps developers test their code. It should take in any value val and return an object with the following two functions. Example Solution Here, we need to understand how we are returning an object that… Read More »To Be Or Not To Be – 2704

Counter - 2620

Counter – 2620

πŸ”—LC2620 🟒 Easy 🧩 Pattern – Closures πŸ“… Day 2/30 Days of JavaScript Given an integer n, return a counter function. This counter function initially returns n and then returns 1 more than the previous value every subsequent time it is called (n, n + 1, n + 2, etc). Example Solution In JavaScript,… Read More »Counter – 2620

Create Hello World Function β€” 130 JavaScript

Create Hello World Function – 2667

πŸ”— LC2667 🟒 Easy 🧩 Pattern – Closures and Higher Order Functions πŸ“… Day 1/30 Days of JavaScript Write a function createHelloWorld. It should return a new function that always returns “Hello World”. Example Solution While this is a straightforward question, it’s important to understand key JavaScript concepts such as Higher Order Functions,… Read More »Create Hello World Function – 2667

Contains Duplicate LeetCode JS Solution

Contains Duplicate LeetCode – JS Solution

Contains Duplicate – LeetCode problem: We need to check if the given array contains duplicates and return True if duplicates are present and False otherwise. Link: Contains Duplicate LeetCode Difficulty: Easy Examples:Input: nums = [1,2,3,2]Output: true Example 2:Input: nums = [1,2,3,4]Output: false Solution in JavaScript Here we use an object… Read More »Contains Duplicate LeetCode – JS Solution

#30DaysofCode

#30DaysofCode

I had started the #30DaysofCodeπŸ“š challenge while I was revising the basic concepts, data structures, and solving easy problems on LeetCode. I documented this so that it helps both me and others to recall what we have learned. How to use this listπŸ“‘ First, look at the given questions, if… Read More »#30DaysofCode