You are given an m x n matrix where each row is sorted in non-decreasing order, and the first integer of each row is greater than the last integer of the previous row. Given a target integer, return true if the target exists in the matrix or false otherwise. The solution must have a time complexity of O(log(m * n)).
You are given an array of integers where each element represents a color: 0 for red, 1 for white, and 2 for blue. Your task is to sort the array such that all reds (0) appear first, followed by whites (1), and finally blues (2). Solve the problem in one pass with constant extra space, without using any built-in sort functions.
You are given two integers n and k. Find all possible combinations of k numbers selected from the range [1, n], where the numbers are chosen without repetition. The answer should contain all possible combinations of k numbers in any order.
You are given an integer array nums containing unique elements. Find all possible subsets (the power set) of the array nums. The solution set should not contain duplicate subsets, and the result can be returned in any order.
You are given a 2D grid board containing characters and a string word. The task is to determine whether the given word can be formed by starting at any cell in the grid and moving to adjacent cells, which are horizontally or vertically neighboring. The same cell cannot be reused in forming the word.
You are given a sorted integer array nums that has been rotated at an unknown pivot index k. The array may contain duplicates. Your task is to determine whether a given target exists in the array, minimizing the number of operations as much as possible.