All Posts

Leetcode 698: Partition to K Equal Sum Subsets

Given an integer array nums and an integer k, your task is to determine if it is possible to divide this array into k non-empty subsets such that each subset has an equal sum.

Leetcode 704: Binary Search

You are given a sorted array of integers and a target value. Your task is to search for the target in the array. If the target exists, return its index. If it does not exist, return -1. You must achieve a time complexity of O(log n).

Leetcode 705: Design HashSet

Design a custom HashSet without using any built-in hash table libraries. Implement the MyHashSet class with methods to add, remove, and check the existence of a value.

Leetcode 713: Subarray Product Less Than K

Given an array of integers nums and an integer k, return the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than k.

Leetcode 714: Best Time to Buy and Sell Stock with Transaction Fee

You are given an array prices where prices[i] represents the price of a stock on the i-th day, and an integer fee that represents a transaction fee for each transaction. The task is to calculate the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction.

Leetcode 718: Maximum Length of Repeated Subarray

Given two integer arrays nums1 and nums2, your task is to find the maximum length of a contiguous subarray that appears in both arrays.