Hot answers tagged

6 votes

O(nlogn) Lexicographically minimal rotation code but tle on this particular case

You've already found the performance issue yourself (which is great), so I'll just comment on the code in general. Unlearn bad leetcode practices It seems like this was a programming challenge from a ...
G. Sliepen's user avatar
  • 49.4k
4 votes

C++ custom string class implementation

This looks quite good, I see you have thought about most of the corner cases. However, a few were missed: new can throw When you allocate memory with ...
G. Sliepen's user avatar
  • 49.4k
3 votes
Accepted

O(nlogn) Lexicographically minimal rotation code but tle on this particular case

After much scrutinization , I have found another optimization. And the solution got accepted . I don't know about Code Review's policy but it would be really helpful for all if this question stays ...
Aryaman 's user avatar
2 votes

C++ custom string class implementation

You Can Add private Member Functions and friend Functions At least, I think you can. That doesn’t change the the public API one ...
Davislor's user avatar
  • 5,963
2 votes

C++ custom string class implementation

Overview: I found one bug. Your move constructor puts the object into an invalid state, where you can then potentially invoke undefined behavior. You have a small memory leak in the ...
Martin York's user avatar
  • 93.9k

Only top scored, non community-wiki answers of a minimum length are eligible