CNoodle
  • Home
  • Archives
  • Tags
  • About
_

[LeetCode] 130. Surrounded Regions

You are given an m x n matrix board containing letters ‘X’ and ‘O’, capture regions that are surrounded: Connect: A cell is connected to adjacent cells horizontally or vertically.Region: To form a reg
2020-05-02
#leetcode #array #java #bfs #dfs #matrix

[LeetCode] 1095. Find in Mountain Array

(This problem is an interactive problem.) You may recall that an array arr is a mountain array if and only if: arr.length >= 3There exists some i with 0 < i < arr.length - 1 such that:ar
2020-04-29
#leetcode #array #java #binary search

[LeetCode] 704. Binary Search

Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You
2020-04-29
#leetcode #java #javascript #binary search

[LeetCode] 221. Maximal Square

Given an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. Example 1: Input: matrix = [[“1”,”0”,”1”,”0”,”0”],[“1”,”0”,”1”,”1”,”1”],[“1”
2020-04-28
#leetcode #java #dynamic programming #matrix

[LeetCode] 621. Task Scheduler

You are given an array of CPU tasks, each represented by letters A to Z, and a cooling time, n. Each cycle or interval allows the completion of one task. Tasks can be completed in any order, but there
2020-04-26
#leetcode #hashmap #java #greedy #heap

[LeetCode] 18. 4Sum

Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that:0 <= a, b, c, d < na, b, c, and d are distinct.nums[a] + nums
2020-04-26
#leetcode #array #two pointer #java #javascript #two sum

[LeetCode] 380. Insert Delete GetRandom O(1)

Design a data structure that supports all following operations in average O(1) time. insert(val): Inserts an item val to the set if not already present.remove(val): Removes an item val from the set if
2020-04-24
#leetcode #array #hashmap #java #math #design #random

[LeetCode] 80. Remove Duplicates from Sorted Array II

Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the s
2020-04-22
#leetcode #array #two pointer #java #javascript

[LeetCode] 105. Construct Binary Tree from Preorder and Inorder Traversal

Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree. Exa
2020-04-21
#leetcode #java #tree #dfs #recursion

[LeetCode] 1248. Count Number of Nice Subarrays

Given an array of integers nums and an integer k. A continuous subarray is called nice if there are k odd numbers on it. Return the number of nice sub-arrays. Example 1:Input: nums = [1,1,2,1,1],
2020-04-21
#leetcode #array #two pointer #hashmap #java #prefix sum
1…3031323334…43

Search

Hexo Fluid