[LeetCode] 729. My Calendar I You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking. A double booking happens when two events have some non-empty interse 2022-07-05 #leetcode #java #treemap #design
[LeetCode] 2116. Check if a Parentheses String Can Be Valid A parentheses string is a non-empty string consisting only of ‘(‘ and ‘)’. It is valid if any of the following conditions is true:It is ().It can be written as AB (A concatenated with B), where A and 2022-07-02 #leetcode #java #greedy #string #stack
[LeetCode] 1491. Average Salary Excluding the Minimum and Maximum Salary You are given an array of unique integers salary where salary[i] is the salary of the ith employee. Return the average salary of employees excluding the minimum and maximum salary. Answers within 10-5 2022-02-07 #leetcode #array #java #math
[LeetCode] 2000. Reverse Prefix of Word Given a 0-indexed string word and a character ch, reverse the segment of word that starts at index 0 and ends at the index of the first occurrence of ch (inclusive). If the character ch does not exist 2022-02-06 #leetcode #two pointer #java #string
[LeetCode] 1072. Flip Columns For Maximum Number of Equal Rows You are given an m x n binary matrix matrix. You can choose any number of columns in the matrix and flip every cell in that column (i.e., Change the value of the cell from 0 to 1 or vice versa). Retur 2021-11-21 #leetcode #array #hashmap #java #matrix
[LeetCode] 1436. Destination City You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, that is, the city without any path outg 2021-10-06 #leetcode #hashmap #java #string
[LeetCode] 1963. Minimum Number of Swaps to Make the String Balanced You are given a 0-indexed string s of even length n. The string consists of exactly n / 2 opening brackets ‘[‘ and n / 2 closing brackets ‘]’. A string is called balanced if and only if:It i 2021-08-18 #leetcode #java #greedy #string #stack
[LeetCode] 1053. Previous Permutation With One Swap Given an array of positive integers arr (not necessarily distinct), return thelexicographically largest permutation that is smaller than arr, that can be made with exactly one swap. If it cannot be do 2021-08-16 #leetcode #array #java #greedy #treemap
[LeetCode] 1962. Remove Stones to Minimize the Total You are given a 0-indexed integer array piles, where piles[i] represents the number of stones in the ith pile, and an integer k. You should apply the following operation exactly k times:Choose any pil 2021-08-16 #leetcode #array #java #greedy #heap
[LeetCode] 1137. N-th Tribonacci Number The Tribonacci sequence Tn is defined as follows:T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0.Given n, return the value of Tn. Example 1:Input: n = 4 2021-08-08 #leetcode #java #math #dynamic programming #memorization