Solving leetcode in C++ and Rust in parallel (two solutions for every problem, switching the language you use first) seems to be an interesting and useful experience.

The contrast and language differences is highlighted as never: you see how much easier and compact is a binary tree traversal in C++, and you see how many possible issues are prevented by Rust compiler which enforces you to check and recheck every step in the very same function.
At the moment I've got quite a number of segfaults for corner cases in C++ solutions and still waiting for the first Rust one :)

Still not sure if the leetcode (or other competitive programming problems) are connected to our daily coding experience, but my personal feeling "In C++ you compile it right away and then fight with gdb to make it run; in Rust you fight with compiler and then happily use it right after it's compiled" is confirmed again.

0
Share
Share on Mastodon
Share on Twitter
Share on Facebook
Share on Linkedin
Replies