All Posts

Leetcode 921: Minimum Add to Make Parentheses Valid

You are given a string consisting of parentheses. In one move, you can insert a parenthesis (either ‘(’ or ‘)’) at any position in the string. Your task is to return the minimum number of moves required to make the string valid, meaning all parentheses are properly balanced.

Leetcode 945: Minimum Increment to Make Array Unique

You are given an integer array nums. In one move, you can select any index i where 0 <= i < nums.length and increment nums[i] by 1. Your task is to find the minimum number of moves required to make all the values in nums unique.

Leetcode 948: Bag of Tokens

You are given an array of tokens and an initial amount of power. The goal is to maximize the score by playing the tokens strategically. In each turn, you can either play a token face-up or face-down. Playing a token face-up costs you power but increases your score, while playing a token face-down gains you power but decreases your score. Your task is to determine the maximum score you can achieve after playing the tokens.

Leetcode 954: Array of Doubled Pairs

Given an integer array of even length, determine if it is possible to reorder the array such that for every index i, arr[2 * i + 1] = 2 * arr[2 * i] holds true. If it is possible to reorder the array in this way, return true, otherwise return false.

Leetcode 955: Delete Columns to Make Sorted II

You are given an array of strings, where each string is of the same length. You are allowed to delete any number of columns, and after deleting the selected columns, the remaining strings should be in lexicographically non-decreasing order. Your task is to determine the minimum number of columns that must be deleted to achieve this order.

Leetcode 969: Pancake Sorting

You are tasked with sorting an array of integers by performing a series of pancake flips. A pancake flip involves reversing the order of elements from the start of the array up to a specified index. The goal is to determine the sequence of flips needed to sort the array in ascending order.