Memoize - Leetcode 2623 - JavaScript 30-Day Challenge

preview_player
Показать описание
Solving Day 9 of the Leetcode 30-day javascript challenge. Today's topic is Memoization, something most hard core neetcoders should be familiar with. =)

0:00 - Read the problem
0:20 - Read sample code
0:55 - Read Editorial
3:15 - Coding solution
6:05 - Decorator Design Pattern
7:15 - JSON Stringify - Unique key

leetcode 2623

#neetcode #leetcode #python
Рекомендации по теме
Комментарии
Автор

i used an array as the key here and it worked fine

julianelmasry
Автор

Your videos are so helpful ! thank you from bottom of my heart!!

shrutivvv
Автор

nit:- The Leetcode problem number in the title says 2629 but in fact is 2623. Might make it difficult for people searching for a solution by the problem number. Also, thanks for the daily uploads. They make us all better programmers each day - one bit at a time :)

ar.ventures
Автор

I am an experienced JS developer (yes experienced for job tasks i mean 😂) but this is great for logic building. Thanks a lot 🫰 keep uploading.

Also can you please share your website graph config? I want to take a look at it. It uses the antv x6 graph right?

chizuru
Автор

very nicely explained, thankyou so much.

pranavkumar
Автор

I used *args.join("-")* as the key which worked for this problem with integers.

But *JSON.stringify()* is a better option.
THANKS!

Android-
Автор

in the stringify function, why do we use args, and not the spread operator ...args?

teqarine
Автор

let's say we memoized a function sum, should memoize(1, 2, 3) and memoize(3, 2, 1) be considered the same and the callCount be 1?

rmvfzmt
Автор

Day 9 of doing the 30-day challenge with NeetCode

vixguy
Автор

2:22 like! I do not now same about React, because u now

TheMarkBrut
Автор

Did you solve memorize 2 ?
I didnt find it :(

arin
Автор

Taking about the design pattern,
Isn't this strategy design pattern?

Because we could pass any parameter(strategy) to memoize.

navenkumarduraisamy
Автор

what is difference between
a)
const key = args.toString();

and
b)
const key = JSON.stringify(args);

?

why b) is faster than a) by 2-3 times always???

anishkarthik
Автор

I see that on line 12 you have cache[key] = fn(...args);

My question is, if cache is declared as a const, how are you able to add to it?

inanismailov
Автор

What if order of arguments is different but values are same

StoneAge
Автор

2:25 if you are writing angular, why don't you go for typescript in daily js challenge? XD

keep it up

hoyinli
welcome to shbcf.ru