CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 2133. Check if Every Row and Column Contains All Numbers

An n x n matrix is valid if every row and every column contains all the integers from 1 to n (inclusive). Given an n x n integer matrix matrix, return true if the matrix is valid. Otherwise, return fa
2022-11-23
#leetcode #array #hashmap #java #matrix

[LeetCode] 1768. Merge Strings Alternately

You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the other, append the additional letters onto the e
2022-10-23
#leetcode #two pointer #java #string

[LeetCode] 1700. Number of Students Unable to Eat Lunch

The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers 0 and 1 respectively. All students stand in a queue. Each student either prefers square or circular sa
2022-10-19
#leetcode #array #java #greedy #simulation

[LeetCode] 1328. Break a Palindrome

Given a palindromic string of lowercase English letters palindrome, replace exactly one character with any lowercase English letter so that the resulting string is not a palindrome and that it is the
2022-10-11
#leetcode #java #greedy #string

[LeetCode] 2007. Find Original Array From Doubled Array

An integer array original is transformed into a doubled array changed by appending twice the value of every element in original, and then randomly shuffling the resulting array. Given an array changed
2022-09-18
#leetcode #array #hashmap #java #greedy #sort

[LeetCode] 1608. Special Array With X Elements Greater Than or Equal X

You are given an array nums of non-negative integers. nums is considered special if there exists a number x such that there are exactly x numbers in nums that are greater than or equal to x. Notice th
2022-09-12
#leetcode #array #java #counting sort #sort #binary search #binary search on answer

[LeetCode] 1184. Distance Between Bus Stops

A bus has n stops numbered from 0 to n - 1 that form a circle. We know the distance between all pairs of neighboring stops where distance[i] is the distance between the stops number i and (i + 1) % n.
2022-07-24
#leetcode #array #java

[LeetCode] 828. Count Unique Characters of All Substrings of a Given String

Let’s define a function countUniqueChars(s) that returns the number of unique characters in s. For example, calling countUniqueChars(s) if s = “LEETCODE” then “L”, “T”, “C”, “O”, “D” are the uniq
2022-07-12
#leetcode #hashmap #java #string

[LeetCode] 729. My Calendar I

You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking. A double booking happens when two events have some non-empty interse
2022-07-05
#leetcode #java #treemap #design

[LeetCode] 2116. Check if a Parentheses String Can Be Valid

A parentheses string is a non-empty string consisting only of ‘(‘ and ‘)’. It is valid if any of the following conditions is true:It is ().It can be written as AB (A concatenated with B), where A and
2022-07-02
#leetcode #java #greedy #string #stack
1…1819202122…46

Search

Hexo Fluid