Given two integers a and b, generate a string of length a + b such that the string contains exactly a ‘a’ letters and exactly b ‘b’ letters, while ensuring the substring ‘aaa’ and ‘bbb’ do not appear.
You are given a broken calculator that displays an integer ‘startValue’. In each operation, you can either multiply the number by 2 or subtract 1. Your task is to determine the minimum number of operations needed to transform ‘startValue’ into ’target’.
You are given two arrays, tops and bottoms, where each array represents the top and bottom halves of a series of dominoes. A domino can be rotated, which means swapping its top and bottom halves. The task is to determine the minimum number of rotations required to make either the entire top row or the bottom row consist of the same value. If it is not possible to achieve this, return -1.
You are given a set of video clips from a sporting event that lasts a specified duration in seconds. The clips may overlap and have varying lengths. The goal is to determine the minimum number of clips required to cover the entire event. If it’s impossible to cover the entire event, return -1.
A company is planning to interview 2n people, and for each person, there are two possible cities where they can be interviewed. The cost of flying a person to city A or city B is given. You need to find the minimum cost to fly exactly n people to each city. The challenge is to select n people for city A and the remaining n people for city B such that the total cost is minimized.
Given an array of positive integers, return the lexicographically largest permutation that is smaller than the given array. This can be done by swapping exactly two elements. If no such swap is possible (i.e., the array is already the smallest permutation), return the same array.