CNoodle
  • Home
  • Archives
  • Tags
  • About
_

[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 #dynamic programming #math #memoization

[LeetCode] 791. Custom Sort String

order and str are strings composed of lowercase letters. In order, no letter occurs more than once. order was sorted in some custom order previously. We want to permute the characters of str so that t
2021-07-15
#leetcode #hashmap #java #counting sort #sort #string

[LeetCode] 1930. Unique Length-3 Palindromic Subsequences

Given a string s, return the number of unique palindromes of length three that are a subsequence of s. Note that even if there are multiple ways to obtain the same subsequence, it is still only counte
2021-07-13
#leetcode #hashmap #java #string #palindrome

[LeetCode] 1905. Count Sub Islands

You are given two m x n binary matrices grid1 and grid2 containing only 0’s (representing water) and 1’s (representing land). An island is a group of 1’s connected 4-directionally (horizontal or verti
2021-07-05
#leetcode #java #bfs #dfs #flood fill

[LeetCode] 1886. Determine Whether Matrix Can Be Obtained By Rotation

Given two n x n binary matrices mat and target, return true if it is possible to make mat equal to target by rotating mat in 90-degree increments, or false otherwise. Example 1: Input: mat = [[0,
2021-06-17
#leetcode #array #java #matrix
1…1819202122…43

Search

Hexo Fluid