|
|
|
|
|
by amirkdv
2114 days ago
|
|
> > given a list of numbers, return two numbers such that one times the other results in 220 > > is the list sorted? > this barely qualifies as a clarifying question in my opinion. Maybe I'm being too charitable but whether or not the list is sorted is very relevant to the first solution that came to my mind as I read the problem. for i from 1 to n:
for j from i+1 to n:
prod = a[i] * a[j]
if prod == 220:
# found it
if prod > 220:
break
# don't waste time, assumes sorted
|
|
Another "clarifying question" in this vein would be "if there is a valid answer, will they be in index 0 and 1 of the list?"
I'm obviously being somewhat facetious here but there's a difference between clearing up an ambiguous part of the question versus asking something that the interviewer gave no indication would be part of the problem.