All Posts

Leetcode 2331: Evaluate Boolean Binary Tree

You are given the root of a full binary tree. The leaf nodes hold boolean values: 0 (False) and 1 (True). The non-leaf nodes hold values 2 (OR) or 3 (AND). Your task is to evaluate the tree according to the logical operations and return the final boolean result of the root node.

Leetcode 2335: Minimum Amount of Time to Fill Cups

You have a water dispenser that dispenses cold, warm, and hot water. Every second, you can either fill up 2 cups with different types of water, or 1 cup of any type of water. You are given an array ‘amount’ where amount[0], amount[1], and amount[2] represent the number of cold, warm, and hot water cups you need to fill, respectively. Your task is to determine the minimum number of seconds required to fill all the cups.

Leetcode 2341: Maximum Number of Pairs in Array

You are given an integer array nums. In one operation, you can choose two integers in the array that are the same and remove both. The operation is repeated as many times as possible. Return an array where the first element is the number of pairs formed, and the second element is the number of leftover integers.

Leetcode 2347: Best Poker Hand

You are given an integer array ranks and a character array suits. These represent a set of 5 playing cards, where each card has a rank (from 1 to 13) and a suit (one of ‘a’, ‘b’, ‘c’, or ’d’). Determine the best possible poker hand you can make from the cards.

Leetcode 2351: First Letter to Appear Twice

Given a string s of lowercase English letters, return the first letter that appears twice.

Leetcode 2357: Make Array Zero by Subtracting Equal Amounts

You are given a non-negative integer array nums. In each operation, you must:

  • Choose a positive integer x that is less than or equal to the smallest non-zero element in nums.
  • Subtract x from every positive element in nums.

Return the minimum number of operations to make every element in nums equal to 0.