CNoodle
  • Home
  • Archives
  • Tags
  • About

[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

[LeetCode] 36. Valid Sudoku

Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each row must contain the digits 1-9 without repetition.Each column must contain
2020-04-20
#leetcode #array #hashmap #java #string

[LeetCode] 695. Max Area of Island

You are given an m x n binary matrix grid. An island is a group of 1’s (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded
2020-04-16
#leetcode #java #bfs #dfs #flood fill

[LeetCode] 994. Rotting Oranges

You are given an m x n grid where each cell can have one of three values:0 representing an empty cell,1 representing a fresh orange, or2 representing a rotten orange.Every minute, any fresh orange tha
2020-04-16
#leetcode #array #java #javascript #bfs #flood fill

[LeetCode] 78. Subsets

Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example 1:Input: num
2020-04-16
#leetcode #array #java #backtracking

[LeetCode] 523. Continuous Subarray Sum

Given an integer array nums and an integer k, return true if nums has a good subarray or false otherwise. A good subarray is a subarray where:its length is at least two, andthe sum of the elements of
2020-04-15
#leetcode #array #hashmap #java #javascript #MOD #prefix sum #math

[LeetCode] 560. Subarray Sum Equals K

Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k. A subarray is a contiguous non-empty sequence of elements within an array. Example 1:Input
2020-04-14
#leetcode #array #hashmap #java #javascript #prefix sum

[LeetCode] 525. Contiguous Array

Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1. Example 1:Input: nums = [0,1]Output: 2Explanation: [0, 1] is the longest contiguous
2020-04-14
#leetcode #array #hashmap #java #javascript #prefix sum

[LeetCode] 362. Design Hit Counter

Design a hit counter which counts the number of hits received in the past 5 minutes. Each function accepts a timestamp parameter (in seconds granularity) and you may assume that calls are being made t
2020-04-14
#leetcode #java #design
1…2930313233…41

Search

Hexo Fluid