I’ve joined LeetCode’s Content Creator Team to publish official solutions since Oct 26, 2020. Here you may find some of my work that’s published on LeetCode:
Continue reading “LeetCode Authorized Author”Database Index
According to WIKIPEDIA, a database index is a data structure that improves the speed of data retrieval on a database table at the cost of additional writes and storage space to maintain the index. One of the most used data structure to implement index is B-tree. Generally, there are two types of index: clustered index and non-clustered index.
Continue reading “Database Index”Java Garbage Collection
What is garbage collection
Continue reading “Java Garbage Collection”[Leetcode]1626. Best Team With No Conflicts
You are the manager of a basketball team. For the upcoming tournament, you want to choose the team with the highest overall score. The score of the team is the sum of scores of all the players in the team. However, the basketball team is not allowed to have conflicts. A conflict exists if a younger player has a strictly higher score than an older player. A conflict does not occur between players of the same age. Given two lists,Continue reading “[Leetcode]1626. Best Team With No Conflicts”scores
andages
, where eachscores[i]
andages[i]
represents the score and age of theith
player, respectively, return the highest overall score of all possible basketball teams.
[Challenge]Minimum adjacent swaps required to Sort Binary array
Given a binary array, task is to sort this binary array using minimum swaps. We are allowed to swap only adjacent elementsContinue reading “[Challenge]Minimum adjacent swaps required to Sort Binary array”
[Leetcode]179. Largest Number
Given a list of non negative integers, arrange them such that they form the largest number.Continue reading “[Leetcode]179. Largest Number”
[Leetcode]48. Rotate Image
You are given an n x n 2D matrix
representing an image, rotate the image by 90 degrees (clockwise).
You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
Continue reading “[Leetcode]48. Rotate Image” [Leetcode]1589. Maximum Sum Obtained of Any Permutation
We have an array of integers,Continue reading “[Leetcode]1589. Maximum Sum Obtained of Any Permutation”nums
, and an array ofrequests
whererequests[i] = [starti, endi]
. Theith
request asks for the sum ofnums[starti] + nums[starti + 1] + ... + nums[endi - 1] + nums[endi]
. Bothstarti
andendi
are 0-indexed. Return the maximum total sum of all requests among all permutations ofnums
. Since the answer may be too large, return it modulo109 + 7
.