27/

directory
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: BSD-3-Clause

README

Name

27 - find lower bound

Description

Problem

Given a sorted array nn, find lower bound for a number x. A lower bound is defined as the minimal value in nn that is not less than x.

Example

The array is [1, 3, 4]. Lower bound for 2 is 3, and for 3 is 3.

Solution

Details

Use binary search to lookup for x but return the upper bound. Take care of the cases when there is no upper bound available if the value x is above the maximum number in the array.

See Also

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL