CNoodle
  • Home
  • Archives
  • Tags
  • About

[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

[LeetCode] 1400. Construct K Palindrome Strings

Given a string s and an integer k, return true if you can use all the characters in s to construct k palindrome strings or false otherwise. Example 1:Input: s = “annabelle”, k = 2Output: tru
2021-06-12
#leetcode #java #greedy #palindrome

[LeetCode] 1331. Rank Transform of an Array

Given an array of integers arr, replace each element with its rank. The rank represents how large the element is. The rank has the following rules: Rank is an integer starting from 1. The larger the
2021-06-08
#leetcode #array #hashmap #java

[LeetCode] 1642. Furthest Building You Can Reach

You are given an integer array heights representing the heights of buildings, some bricks, and some ladders. You start your journey from building 0 and move to the next building by possibly using bric
2021-05-13
#leetcode #java #greedy #heap

[LeetCode] 1720. Decode XORed Array

There is a hidden integer array arr that consists of n non-negative integers. It was encoded into another integer array encoded of length n - 1, such that encoded[i] = arr[i] XOR arr[i + 1]. For
2021-05-06
#leetcode #java #bit manipulation

[LeetCode] 930. Binary Subarrays With Sum

Given a binary array nums and an integer goal, return the number of non-empty subarrays with a sum goal. A subarray is a contiguous part of the array. Example 1:Input: nums = [1,0,1,0,1], goal &#
2021-05-05
#leetcode #array #hashmap #java #prefix sum #sliding window

[LeetCode] 1845. Seat Reservation Manager

Design a system that manages the reservation state of n seats that are numbered from 1 to n. Implement the SeatManager class: SeatManager(int n) Initializes a SeatManager object that will manage n se
2021-05-02
#leetcode #java #design #heap

[LeetCode] 1244. Design A Leaderboard

Design a Leaderboard class, which has 3 functions: addScore(playerId, score): Update the leaderboard by adding score to the given player’s score. If there is no player with such id in the leaderboard,
2021-04-27
#leetcode #hashmap #java #sort #design

[LeetCode] 1838. Frequency of the Most Frequent Element

The frequency of an element is the number of times it occurs in an array. You are given an integer array nums and an integer k. In one operation, you can choose an index of nums and increment the elem
2021-04-26
#leetcode #array #greedy #prefix sum #sort #sliding window

[LeetCode] 1670. Design Front Middle Back Queue

Design a queue that supports push and pop operations in the front, middle, and back. Implement the FrontMiddleBack class:FrontMiddleBack() Initializes the queue.void pushFront(int val) Adds val to the
2021-04-18
#leetcode #java #design #queue
1…2122232425…48

Search

Hexo Fluid