You are given an integer array representing the prices of chocolates in a store and a total amount of money you have. Your task is to buy exactly two chocolates in a way that ensures you still have some leftover money, and you want to minimize the sum of the prices of the two chocolates. If you cannot buy two chocolates without going into debt, return the original amount of money you had.
Given a positive integer represented as a string, your task is to return the same integer but with all trailing zeros removed. The result should also be returned as a string.
You are given a string s. You can perform two types of operations: (1) Choose an index i and remove the closest occurrence of the character at i to the left of i. (2) Choose an index i and remove the closest occurrence of the character at i to the right of i. Minimize the length of the string s by performing these operations and return the final minimized length.
You are given a permutation of integers from 1 to n. A permutation is called semi-ordered if the first element equals 1 and the last element equals n. You can perform the operation of swapping two adjacent elements as many times as needed to make the permutation semi-ordered. Your task is to return the minimum number of swaps required.
You are given a three-digit integer n. We define a number as fascinating if, when you concatenate n, 2 * n, and 3 * n, the resulting number contains all digits from 1 to 9 exactly once and does not contain any zeros.
You are given an array nums containing distinct positive integers. Your task is to find and return any number from the array that is neither the smallest nor the largest number, or return -1 if no such number exists.