Go vs. C++, First Glance
Adapting to Go from C++ over the last couple of months hasn’t been easy. I was told by many that compared to other mainstream programming languages, C++ is the closest to Go. Well, I’m not sure where that came from, but it’s not true. I decided to write an article comparing both languages at first…
Auto keyword in C++
The keyword “auto” was first introduced in C++111 and was meant to provide an easier and cleaner way to write C++ code. But it has been a controversial feature since it came out because some believed that it’s making the C++ programming language into a dynamically typed language Personally, I’d use auto as much as…
Leetcode [Hard] – “Split Array Largest Sum” in C++
There are some problems on Leetcode that are medium or hard that if you know the trick or have seen it before, you will know how to do it, otherwise, there is not a single way you could come up with solutions under limited time during an interview. There are also types of problems either…
Leetcode [Hard] – “Odd Even Jump” in C++
While I was doing some leetcode problems, one interesting question drew my attention. I spent quite some times on this problem, and ended up solving it with dynamic programming (dp). This problem was particularly interesting and made me write a blog about it because it’s quite a representative dp problem and also uses functions of…
Static Casting in C++
There are four types of casting in C++: Static casting Dynamic casting Const casting Reinterpreted casting Each of the casting exists for a purpose, and should be used with carefulness. This article will talk broadly about what each of the casting does, their use case, and what programmers should know when using them. Since each…
Placement new in C++
Placement new in C++ in the form allows the programmer to allocate an object dynamically onto a pre-allocated memory address. Unlike classical new keyword in C++, placement new does not actually create any memory space in heap. In the code above, an object of type object is created and allocated onto the address pre-allocated buffer,…