This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * --- | |
| * [https://leetcode.com/problems/count-good-nodes-in-binary-tree] | |
| * 1448. Count Good Nodes in Binary Tree | |
| * Given a binary tree root, a node X in the tree is named good if in the path from root to X | |
| * there are no nodes with a value greater than X. | |
| * | |
| * Return the number of good nodes in the binary tree. | |
| * --- | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Stack; | |
| /** | |
| * --- | |
| * [https://leetcode.com/problems/decode-string] | |
| * 394. Decode String | |
| * Given an encoded string, return its decoded string. | |
| * | |
| * The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets | |
| * is being repeated exactly k times. Note that k is guaranteed to be a positive integer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * --- | |
| * [https://leetcode.com/problems/asteroid-collision] | |
| * 735. Asteroid Collision | |
| * We are given an array asteroids of integers representing asteroids in a row. | |
| * | |
| * For each asteroid, the absolute value represents its size, and the sign represents its | |
| * direction (positive meaning right, negative meaning left). Each asteroid moves at the same speed. | |
| * | |
| * Find out the state of the asteroids after all collisions. If two asteroids meet, the smaller |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * --- | |
| * [https://leetcode.com/problems/removing-stars-from-a-string] | |
| * 2390. Removing Stars From a String | |
| * You are given a string s, which contains stars *. | |
| * | |
| * In one operation, you can: | |
| * - Choose a star in s. | |
| * - Remove the closest non-star character to its left, as well as remove the star itself. | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * --- | |
| * [https://leetcode.com/problems/equal-row-and-column-pairs] | |
| * 2352. Equal Row and Column Pairs | |
| * Given a 0-indexed n x n integer matrix grid, return the number of pairs (ri, cj) such that | |
| * row ri and column cj are equal. | |
| * | |
| * -not fully happy though- | |
| * --- | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * --- | |
| * [https://leetcode.com/problems/determine-if-two-strings-are-close] | |
| * 1657. Determine if Two Strings Are Close | |
| * Two strings are considered close if you can attain one from the other using | |
| * the following operations: | |
| * - Operation 1: Swap any two existing characters. | |
| * - Operation 2: Transform every occurrence of one existing character into | |
| * another existing character, | |
| * and do the same with the other character. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * --- | |
| * [https://leetcode.com/problems/unique-number-of-occurrences] | |
| * 1207. Unique Number of Occurrences | |
| * Given an array of integers arr, return true if the number of occurrences of each value in the | |
| * array is unique or false otherwise. | |
| * --- | |
| */ | |
| class Solution { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * --- | |
| * [https://leetcode.com/problems/max-consecutive-ones-iii] | |
| * 1004. Max Consecutive Ones III | |
| * Given a binary array nums and an integer k, return the maximum number of consecutive 1's in the | |
| * array if you can flip at most k 0's. | |
| * --- | |
| */ | |
| class Solution { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * --- | |
| * [https://leetcode.com/problems/longest-subarray-of-1s-after-deleting-one-element] | |
| * 1493. Longest Subarray of 1's After Deleting One Element | |
| * --- | |
| */ | |
| class Solution { | |
| public int longestSubarray(int[] nums) { | |
| int prevSubArray = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * --- | |
| * [https://leetcode.com/problems/maximum-number-of-vowels-in-a-substring-of-given-length] | |
| * 1456. Maximum Number of Vowels in a Substring of Given Length | |
| * Given a string s and an integer k, return the maximum number of vowel letters in any substring | |
| * of s with length k. | |
| * --- | |
| */ | |
| class Solution { |