LeetCode 2716. Minimize String Length - Interview Prep Ep 142

preview_player
Показать описание


⭐ Become a member:

// TOOLS THAT I USE:

// MY FAVORITE BOOKS:

My ENTIRE Programming Equipment and Computer Science Bookshelf:

And make sure you subscribe to my channel!

Your comments/thoughts/questions/advice will be greatly appreciated!

#softwareengineering #leetcode #algorithms #coding #interview #SDE #SWE #SiliconValley #programming #datastructures
Рекомендации по теме
Комментарии
Автор

Excellent logic. Super easy. Didn't think this way. Thanks a lot!

MalobikaNandy
Автор

Hi, nice approach. Just a minor enhancement. We don't need to build minimum size string. We only require to return its length. So, we can just return size of HashSet instead of building string and returning its length.

madanmohan
Автор

TS:

function minStr(str: string) {
const res: {[key: string]: number} = {}

for(let i = 0; i < str.length; i++) {
res[str[i]] = i
}

return Object.keys(res).length;
}

valikonen
Автор

FYI doesn't match your thumbnail. Also can you keep the episode number local to the playlist and keep it out to the title? For example within Hashtable 2716 isn't Episode 142 it's 23 ;-)

rydmerlin