CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 1338. Reduce Array Size to The Half

You are given an integer array arr. You can choose a set of integers and remove all the occurrences of these integers in the array. Return the minimum size of the set so that at least half of the inte
2021-01-23
#leetcode #array #hashmap #java #counting sort #greedy #heap

[LeetCode] 984. String Without AAA or BBB

Given two integers a and b, return any string s such that: s has length a + b and contains exactly a ‘a’ letters, and exactly b ‘b’ letters, The substring ‘aaa’ does not occur in s, and The substring
2021-01-19

[LeetCode] 1405. Longest Happy String

A string s is called happy if it satisfies the following conditions: s only contains the letters ‘a’, ‘b’, and ‘c’. s does not contain any of “aaa”, “bbb”, or “ccc” as a substring. s contains at most
2021-01-19
#leetcode #java #dynamic programming #greedy

[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] 744. Find Smallest Letter Greater Than Target

You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters. Return the smallest character in le
2021-01-14
#leetcode #java #binary search

[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
1…2425262728…48

Search

Hexo Fluid