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] 37. Sudoku Solver

Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 must occur exactly once in each row.Each of the d
2020-04-20
#leetcode #array #java #dfs #matrix #backtracking

[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] 378. Kth Smallest Element in a Sorted Matrix

Given an n x n matrix where each of the rows and columns is sorted in ascending order, return the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order, not
2020-04-19
#leetcode #java #javascript #binary search #matrix #heap #merge sort

[LeetCode] 733. Flood Fill

You are given an image represented by an m x n grid of integers image, where image[i][j] represents the pixel value of the image. You are also given three integers sr, sc, and color. Your task is to p
2020-04-17
#leetcode #java #bfs #dfs #flood fill #matrix

[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
1…3334353637…46

Search

Hexo Fluid