= 0, hi = len(spendings) - 1, ans = 0, mid while lo <= hi: mid = (lo + hi) // 2 if spendings[mid].date <= date: ans = mid lo = mid + 1 else: hi = mid - 1 return ans *0 .BJO#PUUMFOFDL %PNBJO %BUB4USVDUVSF"MHPSJUIN
sp: Vector[Spending], target: LocalDateTime ): Int = if (l <= h) { val m = (l + h) / 2 sp lift m match { case Some(s) if !s.datetime.isAfter(target) ⇒ largestIndex(m + 1, h, m, sp, target) case _ ⇒ largestIndex(l, m - 1, i, sp, target) } } else { i } *0 .BJO#PUUMFOFDL %PNBJO %BUB4USVDUVSF"MHPSJUIN