Skip to content

Update articles#5828

Open
Srihari2222 wants to merge 9 commits into
mainfrom
srihari
Open

Update articles#5828
Srihari2222 wants to merge 9 commits into
mainfrom
srihari

Conversation

@Srihari2222
Copy link
Copy Markdown
Collaborator

@Srihari2222 Srihari2222 commented May 17, 2026

Add TypeScript solutions to multiple algorithm articles

  • Adds TypeScript implementations for 8 algorithm articles: average waiting time, vowel strings in ranges, browser history, find common characters, relative sort array, remove duplicates from sorted array II, sort people, special array, and time needed to buy tickets.
  • Each article receives multiple TypeScript approaches (brute force, optimal, and intermediate strategies) mirroring existing solutions in other languages.
  • Fixes the C# Solution.CommonChars return type from IList<string> to List<string> in find-common-characters.md.
  • Adds C# queue simulation, iteration, and one-pass solutions to time-needed-to-buy-tickets.md.

Macroscope summarized a6ff471.

@Srihari2222 Srihari2222 requested a review from neetcode-gh May 17, 2026 04:53
Comment on lines +599 to +604
nums[i++] = num;
count.set(num, cnt - 1);
if (count.get(num)! >= 1) {
nums[i++] = num;
count.set(num, cnt - 1);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Low articles/remove-duplicates-from-sorted-array-ii.md:599

The second count.set(num, cnt - 1) on line 603 uses the original destructured cnt instead of decrementing the already-decremented value, so it sets the count back to cnt - 1 instead of cnt - 2. This contradicts the Rust version which correctly decrements twice, and misrepresents the algorithm's logic in an educational article. Consider changing to count.set(num, cnt - 2) to correctly reflect the double-decrement.

Suggested change
nums[i++] = num;
count.set(num, cnt - 1);
if (count.get(num)! >= 1) {
nums[i++] = num;
count.set(num, cnt - 1);
}
count.set(num, cnt - 1);
if (count.get(num)! >= 1) {
nums[i++] = num;
count.set(num, cnt - 2);
}
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file articles/remove-duplicates-from-sorted-array-ii.md around lines 599-604:

The second `count.set(num, cnt - 1)` on line 603 uses the original destructured `cnt` instead of decrementing the already-decremented value, so it sets the count back to `cnt - 1` instead of `cnt - 2`. This contradicts the Rust version which correctly decrements twice, and misrepresents the algorithm's logic in an educational article. Consider changing to `count.set(num, cnt - 2)` to correctly reflect the double-decrement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant