filmov
tv
How to Solve '1370 Increasing Decreasing String' on LeetCode? - Javascript

Показать описание
Do you need more help with coding?
════════════════════════════
Problem: #1370 Increasing Decreasing String
Language: #Javascript
Difficulty: Easy
Strategy: ASCII array
Time Complexity: O(n)
Space Complexity: O(n)
Pseudo Code:
1. Create output array.
2. Create charCount array.
3. Loop through s.
a. Fill up the charCount with the corresponding count for each letter.
4. Create count variable.
5. While count is greater than 0.
a. Loop through charCount.
i. Condition if value is greater than 0.
1. Push to output.
2. Decrement the charCount.
3. Decrement the count.
b. Loop backwards through charCount.
i. Condition if value is greater than 0.
1. Push to output.
2. Decrement the charCount.
3. Decrement the count.
6. Return output as string.
GitHub Repo:
Let's Connect 💯:
════════════════════════════
════════════════════════════
Problem: #1370 Increasing Decreasing String
Language: #Javascript
Difficulty: Easy
Strategy: ASCII array
Time Complexity: O(n)
Space Complexity: O(n)
Pseudo Code:
1. Create output array.
2. Create charCount array.
3. Loop through s.
a. Fill up the charCount with the corresponding count for each letter.
4. Create count variable.
5. While count is greater than 0.
a. Loop through charCount.
i. Condition if value is greater than 0.
1. Push to output.
2. Decrement the charCount.
3. Decrement the count.
b. Loop backwards through charCount.
i. Condition if value is greater than 0.
1. Push to output.
2. Decrement the charCount.
3. Decrement the count.
6. Return output as string.
GitHub Repo:
Let's Connect 💯:
════════════════════════════