
Common Algo Problem Solutions - James99
https://github.com/sherxon/AlgoDS/blob/master/README.md
======
elbigbad
So are these just copied from leetcode? For example, leetcode's hamming
distance versus yours:

LeetCode:

The Hamming distance between two integers is the number of positions at which
the corresponding bits are different.

Given two integers x and y, calculate the Hamming distance.

Yours:

1) __Hamming Distance __The Hamming distance between two integers is the
number of positions at which the corresponding bits are different. Given two
integers x and y, calculate the Hamming distance.

Another one, LeetCode:

Given an array of integers, every element appears twice except for one. Find
that single one.

Note: Your algorithm should have a linear runtime complexity. Could you
implement it without using extra memory?

Yours:

2) __Single Number __Given an array of integers, every element appears twice
except for one. Find that single one. Note:Your algorithm should have a linear
runtime complexity. Could you implement it without using extra memory?

~~~
Sherxon
Yes, many problems are the same as leetcode problems. The purpose of this repo
is just learning.

------
lsiebert
First this doesn't include any statements of the specifics of the algorithm
problems, which can be extremely relevant. Second there are errors, for
example the code the return all duplicates in array is just broken, and even
if you fix the obvious errors like indexing and modifying the array you are
examining, it will still not handle values of 0 or less.

~~~
MichaelBurge
I wonder if it makes sense for larger companies like Google to intentionally
plant online unconventional solutions that seem plausible but have subtle
errors. Better still if they point out the errors and give a plausible-
sounding argument for why they don't apply, that the person then later repeats
during the interview without disclosing that he's seen the problem before.

I wonder if there's a way to make money from cheaters caught in the act. The
only thing I can think of is making reimbursement of travel expenses
conditional on not cheating. Or encouraging them to somehow gamble money on
the assumption their solution is correct.

Just using unconventional language to describe the solution could be a good
signal: People learning something new often use the same words as the source
material.

~~~
deft
I'd like to know how this is 'cheating'. The questions are quite simply
memorization problems as the difficulty increases especially. You don't have
to disclose you've seen a problem before. These types of interview questions
are already terrible, and now you are expecting interviewees to intentionally
make it harder for themselves.

I don't get this anti-worker attitude. However I'm not surprised to see it on
HN

~~~
cousin_it
Algorithm problems are supposed to be solved by thinking, not memorization.

~~~
grey-area
That's the theory.

In practice recent prior exposure to the problem and possible solutions makes
answering such a question far easier, so the most prepared for the questions
wins. They don't test thinking, they test preparation.

~~~
vog
Not only that, but some worker may be well prepared without even noticing. And
without any bad intentions to trick you.

This happened to myself (although in a non-interview situation):

In general, if you have solved many problems and looked at many solutions, you
simply won't remember each specific problem. This effect may start as early as
your first math olympiad, and will only get worse on university while you
study math and/or computer science.

Some time ago I solved a math puzzle, where I got the right ideas relatively
quickly, even though I was convinced this problem was new to me. Later I found
out in my writings that I actually solved exactly that problem some years ago.

Even though I was unable to remember the exact solution, not even remembered
I've seen it before, I seem to have internalized enough clues so I could
rediscover the exact solution whenever I need it.

------
gokusaaaan
more like here's another list of algorithms I need to know that's been
featured here on hacker news a gazillion times

------
TACIXAT
Thought this was about Algo VPN. [1]

1\. [https://github.com/trailofbits/algo](https://github.com/trailofbits/algo)

------
downrightmike
Is there a decent algorithm book series that will go in detail the logic
behind each question?

