Anonymous
My codes are usually so big and takes lots of time and often rejected 😖
I_Interface
I_Interface
and readable
Anonymous
read books/watch videos how to write code right
If you search for code optimisation in YouTube... It will only show how code optimisation works in compiler design, course 🤷🤷😂 But I want real time, that can replace my codes or make it better
Anonymous
constexpr and noexcept
What will it do?
I_Interface
Dima
you gotta just get it by yourself
Dima
by looking at examples you won’t get far
I_Interface
never search for this lol!
ye, it was a bad advice(
Dima
I am not talking about theorical things, in fact, practical, but that’ll get to you eventually if you are smart enough
Dima
Anonymous
Two times I have tried for campus drive... Both time I got rejected cause my code wasn't optimised and big😂😂
Dima
show us your code there
Dima
yah
I_Interface
😂😂
bad code: int func (int a, int b) { int sum = a + b; return sum; } better int func (int a, int b) { return a+ b; } as a simple example how it could be optimized with experience
joel
| is the "bitwise or" operator
actually a logical operator
BinaryByter
|| is
BinaryByter
| is just bit wise
joel
No
bitwise operators are used for binary comparisons and i dont see bin numbers iirc
Anonymous
?
joel
| is just bit wise
yh you're right
I_Interface
Do u know about spiral matrix
Don't be afraid to Google, mate :)
Anonymous
It usually takes 4 loops. So the interviewer was actually looking for a code which contains only max 2 loops
Anonymous
Out of 100 only 3 guys solved it 😖😖
I_Interface
Anonymous
Yeah sure
I_Interface
Yeah sure
after that try to write it by urself
I_Interface
there's actually no difference
mate, we were talking about minimize the lines of code with experience
Anonymous
It doesn't matter, when you're working with 100s of people, you need to make sure your code is as readable as possible
joel
they're both readable
joel
infact the 2nd one is more readable
joel
it literally shows u the return value
Anonymous
there's actually no difference
Isn't there a difference, well we are creating the sum variable and allocating it 4 bytes. And in other case nothing, so it's reducing the time complexity, don't u think?
Anonymous
infact the 2nd one is more readable
It's readable in this small code snippet, when the project gets big :(
Anonymous
Anyway it's all #ot
Anonymous
I still don't get it, whats up with this #ot
Anonymous
😐
I_Interface
off top chat
Anonymous
Gotcha
joel
Anonymous
😂
Anonymous
#ot
Anonymous
Move all your off topic chats to there :(
joel
what we were talking about wasnt offtopic or?
joel
it's about cpp
Anonymous
True
klimi
that's why "//" exists
good code doesnt need coments
Anonymous
good code doesnt need coments
That's what I was trying to say
klimi
nope
yes
Anonymous
Code could be self explanatory
BinaryByter
Better code does need them
klimi
thats why we have functions
Anonymous
A function name should tell what it does
I_Interface
That's what I was trying to say
nah, if u will need ur code after a year, u will learn it again ?
BinaryByter
joel
good code doesnt need coments
no comments are acctually important. According to a book i read, there is nothing like self documented code && it's a bad practice not to comment ur code
BinaryByter
i agree with you, but saying 'no comments is stretch'
I_Interface
Need a good documentation for the program, then ur life could be more easy)
Anonymous
no comments are acctually important. According to a book i read, there is nothing like self documented code && it's a bad practice not to comment ur code
In jobs whenever u write a code, u need to write comments in order for everyone to understand ( whoever is looking at Ur code)