On a job interview my friend had to solve this Problem:
Develop an algorithm that receives two variables, a and b both integer and returns the largest.
Example: If
a = 7andb = 7the algorithm returns 7.Restrictions:
- You can not use IF's not anything that comparison;
- Also one can not use Math or colections type libraries, because internally they use IF's;
- You can not use ternary operator, it is an IF.
It was the last question and at bottom of the page had the following sentence:
Do not look for perfection, just do the best you can.
We don't know if it's a hint or just a motivational phrase.
It is not mentioned or required a specific language, then i guess that can be used pseudocode or is a logic problem.
Here are several programmers, no one managed to solve.
Aucun commentaire:
Enregistrer un commentaire