Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 18095

Confusion of a code snippet in a interview

$
0
0

enter image description here

First, i have to mention that the job is a data analyst internship and the only language required is python and i'm a physics student so for me there is a huge difference between "//" and "/".

We first consider the function count1, i literally thought it was a trick question because int(2m != n) was a trick question because it might cause an value error (my bad because i ve been warned so many times about the difference between "//" and "/" in physics, i completely forgot that in other languages "7" can be used for integer division with a return value for floor division. So i stupidtely thought it was a trick question and immediately pointed out that this would possibly give an error message and the "if(2m !=n)" might be unnecessary.

now what really confused me is count0, the second function, i simply pointed out the program doesn't solve anything, there is no pattern. The interviewer said it's supposed to return 0 or 1, but for it to return 0 or 1 then it's supposed to be "count0((n-m/2+1-m)" i.e. every term should be inside the parenthesis, right?

This interview took place yesterday evening, should i write to my interviewer and tell him that even though failling to answer the what the first function does is my fault but your second function has no logic at all? of course in a nicer way.

PS: chatgpt tells me this code is java so i am adding the tag java

As i explained in the above text


Viewing all articles
Browse latest Browse all 18095

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>