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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
strings × 2919java × 635
python × 481
c++ × 397
c × 392
performance × 372
algorithm × 354
beginner × 321
c# × 320
javascript × 213
programming-challenge × 212
python-3.x × 134
parsing × 127
array × 124
regex × 124
interview-questions × 99
formatting × 95
php × 85
reinventing-the-wheel × 77
c++11 × 73
comparative-review × 65
file × 61
search × 61
ruby × 58
random × 55