CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 1471. The k Strongest Values in an Array

Given an array of integers arr and an integer k. A value arr[i] is said to be stronger than a value arr[j] if |arr[i] - m| > |arr[j] - m| where m is the median of the array.If |arr[i] - m| =&#
2021-01-14
#leetcode #array #two pointer #java #sort

[LeetCode] 633. Sum of Square Numbers

Given a non-negative integer c, decide whether there’re two integers a and b such that a2 + b2 = c. Example 1:Input: c = 5Output: trueExplanation: 1 * 1 + 2 * 2 = 5 Example 2:Input: c &
2021-01-12
#leetcode #two pointer #java #math

[LeetCode] 1695. Maximum Erasure Value

You are given an array of positive integers nums and want to erase a subarray containing unique elements. The score you get by erasing the subarray is equal to the sum of its elements. Return the maxi
2021-01-08
#leetcode #array #two pointer #hashmap #java #sliding window #string

[LeetCode] 1679. Max Number of K-Sum Pairs

You are given an integer array nums and an integer k. In one operation, you can pick two numbers from the array whose sum equals k and remove them from the array. Return the maximum number of operatio
2021-01-03
#leetcode #array #two pointer #hashmap #java #sort

[LeetCode] 1457. Pseudo-Palindromic Paths in a Binary Tree

Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be pseudo-palindromic if at least one permutation of the node values in the path is a palindrome. Ret
2020-12-30
#leetcode #java #tree #dfs #preorder #backtracking

[LeetCode] 1358. Number of Substrings Containing All Three Characters

Given a string s consisting only of characters a, b and c. Return the number of substrings containing at least one occurrence of all these characters a, b and c. Example 1:Input: s = “abcabc”Outp
2020-12-24
#leetcode #two pointer #hashmap #java #sliding window #string

[LeetCode] 1020. Number of Enclaves

You are given an m x n binary matrix grid, where 0 represents a sea cell and 1 represents a land cell. A move consists of walking from one land cell to another adjacent (4-directionally) land cell or
2020-12-22
#leetcode #java #bfs #dfs #flood fill

[LeetCode] 921. Minimum Add to Make Parentheses Valid

A parentheses string is valid if and only if: It is the empty string, It can be written as AB (A concatenated with B), where A and B are valid strings, or It can be written as (A), where A is a valid
2020-12-18
#leetcode #java #greedy #stack

[LeetCode] 1669. Merge In Between Linked Lists

You are given two linked lists: list1 and list2 of sizes n and m respectively. Remove list1’s nodes from the ath node to the bth node, and put list2 in their place. The blue edges and nodes in the fol
2020-12-15
#leetcode #java #linked list

[LeetCode] 1609. Even Odd Tree

A binary tree is named Even-Odd if it meets the following conditions:The root of the binary tree is at level index 0, its children are at level index 1, their children are at level index 2, etc.For ev
2020-12-10
#leetcode #java #tree #bfs
1…2223242526…43

Search

Hexo Fluid