반응형
hi.
I've solved a problem related to strings.
It was simple, so I solved it right away. I'm so happy!
Anyway, I'm going to explain this problem.
There are two strings, and you need to combine them character by character, not string by string.
However, some strings have different lengths.
So, regardless of whether their lengths match or not, you should merge them one character at a time.
Here’s my solution:
I used an array to handle undefined elements, which occur due to different string lengths.
First, I pushed all the elements into the array.
Then, I rechecked the elements using forEach with typeof.
As a result, I passed all the test cases! 🎉
It's a small step, but I feel so happy seeing my skills improve day by day! 😊🚀
반응형
'열정가득한 개발자의 이야기 > Javascript Algorithm' 카테고리의 다른 글
1071. Greatest Common Divisor of Strings (JS) (0) | 2025.03.22 |
---|---|
151. Reverse Words in a String (Javascript) (0) | 2025.03.20 |
643. Maximum Average Subarray I with JS (0) | 2025.02.28 |
leetcode 575. Distribute Candies (javascript) (1) | 2025.01.27 |
500. Keyboard Row (javascript) (0) | 2025.01.26 |