Grokking the Coding Interview: Patterns for Coding Questions
Vote

0% completed

​

Ceiling of a Number (medium)

.....

.....

.....

Like the course? Get enrolled and start learning!
A

Anonymous

· 3 years ago

[1, 1, 1, 1, 1] 1

Show 1 reply
A

Anonymous

· 3 years ago

My code failed on a test case that I think is incorrect.

Given: [1, 1, 1, 1, 1] 1

The result should be 0 whereas the test expects 2. which makes no sense.

A

Anonymous

· 3 years ago

Testcase:

[1, 1, 1, 1, 1] 1

Test case expected result: 2

Correct result: 0

The test cases claim 2 is the correct result when the correct answer is clearly 0

Show 1 reply
A

Anonymous

· 3 years ago

Hi,

Could somebody extend the explanation about it? I think that's pretty important but I don't think that I understand.

A

Anonymous

· 4 years ago

Would it be correct in the floor solution to return either end or mid outside the loop? Since integer division "rounds down" so end and mid should always be equivalent by that point.

A

Anonymous

· 5 years ago

Are repeated integers meant to be handed with this solution? For example, for arguments: ([4, 6, 6, 6, 10], 6)

The result is 2. Reading the prompt it is unclear if this is sufficient or if the answer should be 1 in this case.

Show 1 reply

Reading Progress

0%


Vote for new content