All Posts

Leetcode 508: Most Frequent Subtree Sum

Given the root of a binary tree, return the most frequent subtree sum. A subtree sum is the sum of all the node values in the subtree rooted at any node, including the node itself. If there is a tie, return all the subtree sums with the highest frequency.

Leetcode 519: Random Flip Matrix

You are given a binary grid of size m x n, where each cell is initially set to 0. The task is to design an algorithm that can randomly pick a cell that is still 0, flip it to 1, and ensure that all available cells are equally likely to be selected.

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.

Leetcode 523: Continuous Subarray Sum

Given an integer array nums and an integer k, return true if there exists a good subarray, otherwise return false. A good subarray is defined as a subarray whose length is at least 2 and the sum of its elements is a multiple of k.

Leetcode 525: Contiguous Array

Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.

Leetcode 532: K-diff Pairs in an Array

Given an array of integers nums and an integer k, return the number of unique k-diff pairs in the array. A k-diff pair is a pair of integers (nums[i], nums[j]) where the absolute difference between the values of the pair is k, and i != j.