All Posts

Leetcode 278: First Bad Version

You are managing a product development process where each version of the product is based on its previous version. However, you have a version that failed the quality check. Since all subsequent versions are based on the previous ones, they also fail the quality check. Your task is to find the first bad version that caused all subsequent versions to be bad. You are given an API bool isBadVersion(version) that returns true if the version is bad, and false otherwise. Your goal is to find the first bad version while minimizing the number of calls to the API.

Leetcode 1237: Find Positive Integer Solution for a Given Equation

You are given a callable function f(x, y) with a hidden formula and a target value z. Your task is to find all pairs of positive integers x and y such that f(x, y) == z. The function is monotonically increasing, meaning: f(x, y) < f(x + 1, y) and f(x, y) < f(x, y + 1). Return a list of all such pairs. If no valid pairs are found, return an empty list.