You are given an array nums consisting of positive integers. Starting with a score = 0, repeatedly select the smallest unmarked integer, add its value to the score, and mark it along with its adjacent elements (if any). Continue this until all elements are marked, then return the final score.
You are given an array ranks representing the ranks of some mechanics, where ranks[i] is the rank of the i-th mechanic. A mechanic with rank r can repair n cars in r * n^2 minutes. You are also given an integer cars representing the total number of cars waiting to be repaired. Return the minimum time required to repair all the cars when all mechanics can work simultaneously.
Given an n x n chessboard, the knight starts at the top-left corner and visits every cell exactly once. The knight’s movements are represented by a grid where grid[row][col] indicates the order of the knight’s visit to that cell. Determine if this sequence of moves is valid, i.e., the knight moves according to its legal movement pattern.
You are given an array of positive integers nums and a positive integer k. A subset of nums is considered beautiful if it does not contain any two integers whose absolute difference is equal to k. Your task is to return the number of non-empty beautiful subsets of the array nums. A subset is formed by deleting some (possibly none) elements from nums, and two subsets are different if their selected indices are different.
You are given a 0-indexed integer array nums and a positive integer value. In one operation, you can either add or subtract the integer value from any element of the array nums. The MEX (Minimum Excluded Value) of an array is the smallest non-negative integer that does not appear in the array. Your task is to determine the maximum possible MEX of the array nums after performing the mentioned operations any number of times.
You are given a 0-indexed integer array nums of length n. You can perform the following operation as many times as needed: pick an index i that has not been previously selected, and choose a prime number p such that p < nums[i]. Then, subtract p from nums[i]. Your task is to determine if it is possible to make the array strictly increasing by performing the operation described.