Enter this in the search box along with your search terms:
Get all gists from the user santisbon.
user:santisbon
Find all gists with a .yml extension.
extension:yml
Find all gists with HTML files.
language:html
Enter this in the search box along with your search terms:
Get all gists from the user santisbon.
user:santisbon
Find all gists with a .yml extension.
extension:yml
Find all gists with HTML files.
language:html
| /** | |
| * --- | |
| * [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. | |
| * --- | |
| */ |
| 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. |
| /** | |
| * --- | |
| * [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 |
| /** | |
| * --- | |
| * [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. | |
| * |
| /** | |
| * --- | |
| * [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- | |
| * --- | |
| */ |
| /** | |
| * --- | |
| * [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. |
| /** | |
| * --- | |
| * [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 { |
| /** | |
| * --- | |
| * [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 { |
| /** | |
| * --- | |
| * [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; |