Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Very poor description … We don’t know if arrays will be always sorted or we can choose the same project several times?

lejafilip

Sep 11, 2024

If yes, then should be More examples.

2

0

Comments
Comments
P B
P B8 months ago
while (!minCapitalHeap.isEmpty() && capital[minCapitalHeap.peek()] <= availableCapital)

This snippet seems to assume that the array capital is sorted. If "capital" is not sorted and the first element in the array is "> initialCapital", we'll neve...

Nitin Sharma
Nitin Sharma9 days ago

pq sorts it...

The test case assumes, we cannot repeat the projects, while the problem description / constraints does not mention such assumption

On this page