All Posts

Leetcode 486: Predict the Winner

You are given an integer array nums. Two players, Player 1 and Player 2, take turns to pick numbers from either end of the array. Each player adds the selected number to their score. The goal is to determine if Player 1 can win the game. Player 1 wins if they have a higher score or if the scores are tied.

Leetcode 494: Target Sum

You are given an integer array nums and an integer target. You must build an expression by adding ‘+’ or ‘-’ before each element in nums and concatenate them to form an expression. Return the number of different expressions that result in the target value.

Leetcode 497: Random Point in Non-overlapping Rectangles

You are given an array of non-overlapping axis-aligned rectangles. Each rectangle is represented by its bottom-left and top-right corner. Your task is to design a system that can pick a random integer point from the space covered by one of the given rectangles. A point on the perimeter of a rectangle is considered inside the rectangle.

Leetcode 498: Diagonal Traverse

You are given an m x n matrix. The task is to return an array that contains all the elements of the matrix in diagonal order, starting from the top-left and moving diagonally towards the bottom-right. The diagonal order alternates between upward and downward diagonals.

Leetcode 518: Coin Change II

Given a set of coins of different denominations, determine how many distinct combinations of these coins sum up to the target amount.

Leetcode 522: Longest Uncommon Subsequence II

Given an array of strings strs, determine the length of the longest uncommon subsequence between them. An uncommon subsequence is a string that is a subsequence of one string but not the others. If no such subsequence exists, return -1.