You are given a 0-indexed binary string s of even length. A string is considered beautiful if it can be divided into substrings where each substring has an even length and contains only ‘0’s or only ‘1’s. You can modify any character in s to ‘0’ or ‘1’. The task is to return the minimum number of changes required to make the string beautiful.
You are given an array of integers nums and a target sum target. Your task is to find the length of the longest subsequence from nums that sums up to target. A subsequence can be derived by deleting some or no elements from nums while maintaining the original order of the remaining elements. If no such subsequence exists, return -1.
You are given two arrays nums1 and nums2, both containing positive integers. Some elements in the arrays are zeros, which need to be replaced with strictly positive integers. The goal is to make the sums of both arrays equal by replacing the zeros in such a way that the resulting sums are the same. Return the minimum possible sum that can make the sums of both arrays equal, or return -1 if it is impossible.
You are given a 0-indexed integer array nums of length n and an integer k. You can perform an operation where you pick an index i in the range [0, n - 1] and increment nums[i] by 1. You can perform this operation any number of times (including zero). A subarray is considered beautiful if, for every subarray of size 3 or more, the maximum element in that subarray is greater than or equal to k. Your task is to return the minimum number of increment operations needed to make the array beautiful.
In a tournament, there are ’n’ teams numbered from 0 to n-1, where each team is represented as a node in a Directed Acyclic Graph (DAG). You are given an integer ’n’ and a 2D integer array ’edges’, where each element edges[i] = [ui, vi] indicates a directed edge from team ‘ui’ to team ‘vi’, meaning team ‘ui’ is stronger than team ‘vi’. A team will be the champion of the tournament if no other team is stronger than it. If there is exactly one champion, return its index; otherwise, return -1.
You are given a 2D array, access_times, where each entry contains an employee’s name and their system access time in 24-hour format (HHMM). An employee is considered ‘high-access’ if they accessed the system at least three times within any one-hour window. The task is to identify all such high-access employees and return their names.