CtCI-6th-Edition-cpp icon indicating copy to clipboard operation
CtCI-6th-Edition-cpp copied to clipboard

Added a solution to q.12.1 - added a check to eliminate empty string which are pushed using getline

Open kohn1001 opened this issue 7 years ago • 1 comments

…k to eliminate empty strings Without this check it actually doesn't print the last k lines - (tested on Mac)

kohn1001 avatar Mar 05 '17 13:03 kohn1001

Much better version - building a vector of size K (in case K is much larger then the number of lines in file - it's much more efficient)

kohn1001 avatar Jun 09 '17 08:06 kohn1001

@KrishMunot Why have you approved and merged the PR containing many bugs? Especially the crash/undefined behavior by std::transform() to the empty container?

sergio-nsk avatar Oct 16 '22 20:10 sergio-nsk

My bad, feel free to revert it, i thought some of the commits were valid. Please revert it.

On Mon, Oct 17, 2022, 01:46 Sergey @.***> wrote:

@KrishMunot https://github.com/KrishMunot Why have you approved and merged the PR containing many bugs? Especially the crash/undefined behavior by std::transform() to the empty container https://github.com/careercup/CtCI-6th-Edition-cpp/pull/32#discussion_r961317756 ?

— Reply to this email directly, view it on GitHub https://github.com/careercup/CtCI-6th-Edition-cpp/pull/32#issuecomment-1280047955, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7YAUK7E54QMZYBN7RJPVDWDRPABANCNFSM4DCNVHDA . You are receiving this because you were mentioned.Message ID: @.***>

KrishMunot avatar Oct 16 '22 21:10 KrishMunot

I can revert it, but it will require your approve, since I have no right to merge PRs.

sergio-nsk avatar Oct 17 '22 06:10 sergio-nsk

Sure, no problem. I'll approve it.

On Mon, Oct 17, 2022, 11:43 Sergey @.***> wrote:

I can revert it, but it will require your approve, since I have not right to merge.

— Reply to this email directly, view it on GitHub https://github.com/careercup/CtCI-6th-Edition-cpp/pull/32#issuecomment-1280339776, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7YAUNMA7DAP23J4HTOHP3WDTU77ANCNFSM4DCNVHDA . You are receiving this because you were mentioned.Message ID: @.***>

KrishMunot avatar Oct 17 '22 06:10 KrishMunot