Anonymous
well 2 * strlen(str) + 1
Anonymous
because you want to have it null termanited
Anonymous
now i am unsure currently if it will handle cases like: abbca correctly unfortunatly
Anonymous
it theoritically should
Anonymous
now that i added that —j
Anonymous
the 3 xors are there as a swaping algorithm
Anonymous
you can do it just by using a temp variable
Anonymous
but i am bad with names for variables
Anonymous
shit
Anonymous
that —j should be ++j
Anonymous
another way of doing it would be to just count the number of each occurance in the string
Anonymous
then find the smallest odd number
Anonymous
that one will be in the middle
Anonymous
and then add 1 to the rest of the odd numbers
Anonymous
then find the smallest odd number
actually you do not even need this
Anonymous
so: int ret = -1; int buffer[SIZE_OF_ENGLISH_ALPHABET]; for (size_t i = 0; i < strlen(str); ++i) ++buffer[(str[i] | 0x20) - 0x61]; for (int i = 0; i < SIZE_OF_ENGLISH_ALPHABET; ++i) if (buffer[i] % 2) ret += 1; if (ret == -1) ret = 0;
yuuki
I'm grateful for your support If there were a repping system, I'd very much do that..
Anonymous
welcome
Anonymous
you can also go extend it to all ascii values
Anonymous
and all unicode values
Anonymous
which in turn will be a larger array size
yuuki
Any thoughts on inserting characters?
Anonymous
Anonymous
it inserts those characters into the string
Anonymous
but as you can see that is about O(n^2)
Anonymous
which is better
Anonymous
but changes the problem a bit
MᏫᎻᎯᎷᎷᎬᎠ
Didn't insert any char But i followed an easy way to produce a palindrome O:-)
Anonymous
and wrong
Anonymous
it is not minimal
Anonymous
for abbca it will do abbcaacbba
Anonymous
which is more then what it should be
Anonymous
abbcbba
MᏫᎻᎯᎷᎷᎬᎠ
MᏫᎻᎯᎷᎷᎬᎠ
I admit it
Anonymous
this is the wrong solution
MᏫᎻᎯᎷᎷᎬᎠ
Okay i get it
Mat
Welcome!
klimi
Welcome
Dima
rip
Dima
MᏫᎻᎯᎷᎷᎬᎠ
BinaryByter
BinaryByter
Well maybe for someone who values code smells, it is
Anonymous
Guys please send the pdf of system software by Leland beck please
BinaryByter
## Welcome We're very glad to welcome you to join the International C/C++ Group. You can invite others by https://t.me/programminginc ## Rules * C/C++ discussion preffered (assembly also allowed), keep other languages to a minimum. * Reverse enginnering, hacking (not facebook, instagram, etc.) * Legitimate requests for help on code and programming questions are ok (no homework requests, or "pls write entire program for me" requests). * Asking for book recommendations is ok, but "pls give pdf book" is not allowed, find books by yourself: google.com, http://gen.lib.rus.ec, https://t.me/programminginc/6504. * Only English language is allowed, if you speak very shitty English you will be banned. * A little bit of programming related memes, jokes, shitposting are allowed. * NSFW content (porn, nudity, etc.) is not allowed. * Spamming will grant you a warning or an immediate ban if you spam right after joining. * Religion, politics and ideological topics are forbidden. ## Resources About asking good questions: * [English](http://www.catb.org/esr/faqs/smart-questions.html) * [Translations](http://www.catb.org/esr/faqs/smart-questions.html#translations) For posting long code snippets: * [GitHub Gist](https://gist.github.com) * [Ubuntu Paste](https://paste.ubuntu.com/) ## Reports If you notice any forbidden content, please use the /report command while responding to the offending post to report it to the admins.
* Asking for book recommendations is ok, but "pls give pdf book" is not allowed, find books by yourself: google.com, http://gen.lib.rus.ec, https://t.me/programminginc/6504.
Anonymous
Effective modern C++
its kinda focused on the features and good practices more than teaching the fundamentals themselves , right ?
olli
its kinda focused on the features and good practices more than teaching the fundamentals themselves , right ?
Exactly. it shows best practices for C++11 and C++14 language features such as smart pointers, rvalue references, forwarding references any many more
Niko
Is turbo c++ still used somewhere?
Shyamu
Yess
Niko
Unfortunately
Abde
It should be dead imo
Niko
Yeah
Niko
I just wanted to see if there was atleast one use case :p
Anonymous
Hi
Anonymous
The indians are very selfish and thet dont know technology
Anonymous
Anonymous
Anybody has web developers groups link
Anonymous
@webdev
Anonymous
@webdevelopers
Anonymous
@webdevelopers
😅 Not these they are dead
Anonymous
Yup I recommend u to read effective C++: third edition before this one
the dude who wrote those books is obsessed with best practices
John
From where?
Anonymous
Thats nice
Anonymous
I'm have a elective choose from advance algorithm or software arch