반응형
Hi! Happy New Year to you too!
I'm in Korea for a while to celebrate the Korean New Year with my family.
Even though I'm on holiday, I'm still studying algorithms to improve my logical thinking.
Anyway, this is what I'd solved.
Summary of My Solution:
This problem involves using arrays and the Set data structure to determine the maximum number of unique types.
Here's my approach:
- Initially, I solved the problem using an if statement, and it worked well.
- However, I wanted to make the code more concise, so I refactored it with a ternary operator. There was no significant difference in runtime between the if statement and the ternary operator.
- Personally, I prefer the ternary operator because it makes the code more compact and simple. I love writing code that's simple and readable.
Overall, I feel that I improved my logical thinking today.
Comparing my previous skills to my recent progress, I'm confident that my skills are improving.
Next, I'll aim to solve medium-level LeetCode problems as soon as possible.
반응형
'열정가득한 개발자의 이야기 > Javascript Algorithm' 카테고리의 다른 글
151. Reverse Words in a String (Javascript) (0) | 2025.03.20 |
---|---|
643. Maximum Average Subarray I with JS (0) | 2025.02.28 |
500. Keyboard Row (javascript) (0) | 2025.01.26 |
leet code 409. Longest Palindrome (0) | 2025.01.18 |
leet code 387. First Unique Character in a String (javascript) (1) | 2025.01.16 |