CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 1052. Grumpy Bookstore Owner

Today, the bookstore owner has a store open for customers.length minutes. Every minute, some number of customers (customers[i]) enter the store, and all those customers leave after the end of that mi
2021-02-24
#leetcode #array #two pointer #java #sliding window #sliding window with fixed size

[LeetCode] 765. Couples Holding Hands

There are n couples sitting in 2n seats arranged in a row and want to hold hands. The people and seats are represented by an integer array row where row[i] is the ID of the person sitting in the ith s
2021-02-14
#leetcode #java #greedy #graph #union find

[LeetCode] 1208. Get Equal Substrings Within Budget

You are given two strings s and t of the same length and an integer maxCost. You want to change s to t. Changing the ith character of s to ith character of t costs |s[i] - t[i]| (i.e., the absolute di
2021-02-10
#leetcode #array #two pointer #java #sliding window

[LeetCode] 1423. Maximum Points You Can Obtain from Cards

There are several cards arranged in a row, and each card has an associated number of points. The points are given in the integer array cardPoints. In one step, you can take one card from the beginning
2021-02-06
#leetcode #array #java #sliding window #sliding window with fixed size

[LeetCode] 643. Maximum Average Subarray I

You are given an integer array nums consisting of n elements, and an integer k. Find a contiguous subarray whose length is equal to k that has the maximum average value and return this value. Any answ
2021-02-05
#leetcode #array #java #javascript #sliding window #sliding window with fixed size

[LeetCode] 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.For example, abcde -> aecdbOperation 2: Transform
2021-01-25
#leetcode #hashmap #java #greedy

[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 #greedy #counting sort #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] 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
1…2122232425…43

Search

Hexo Fluid