[LeetCode] 437. Path Sum III Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum. The path does not need to start or end at the root or 2020-07-30 #leetcode #java #tree #preorder #prefix sum
[LeetCode] 529. Minesweeper Let’s play the minesweeper game (Wikipedia, online game)! You are given an m x n char matrix board representing the game board where: ‘M’ represents an unrevealed mine,‘E’ represents an unrevealed emp 2020-07-23 #leetcode #array #java #dfs #matrix
[LeetCode] 417. Pacific Atlantic Water Flow There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island’s left and top edges, and the Atlantic Ocean touches the island’s righ 2020-07-23 #leetcode #java #bfs #dfs #flood fill
[LeetCode] 329. Longest Increasing Path in a Matrix Given an m x n integers matrix, return the length of the longest increasing path in matrix. From each cell, you can either move in four directions: left, right, up, or down. You may not move diagonall 2020-07-22 #leetcode #array #java #dfs #matrix #memorization
[LeetCode] 1100. Find K-Length Substrings With No Repeated Characters Given a string s and an integer k, return the number of substrings in s of length k with no repeated characters. Example 1:Input: s = “havefunonleetcode”, k = 5Output: 6Explanation: There ar 2020-07-20 #leetcode #hashmap #java #sliding window #sliding window with fixed size #string
[LeetCode] 904. Fruit Into Baskets You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array fruits where fruits[i] is the type of fruit the ith tree produce 2020-07-18 #leetcode #two pointer #hashmap #java #sliding window
[LeetCode] 785. Is Graph Bipartite There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More formall 2020-07-16 #leetcode #java #javascript #bfs #dfs #graph
[LeetCode] 1512. Number of Good Pairs Given an array of integers nums, return the number of good pairs. A pair (i, j) is called good if nums[i] == nums[j] and i < j. Example 1:Input: nums = [1,2,3,1,1,3]Output: 4Explanat 2020-07-13 #leetcode #array #hashmap #java #math
[LeetCode] 430. Flatten a Multilevel Doubly Linked List You are given a doubly linked list, which contains nodes that have a next pointer, a previous pointer, and an additional child pointer. This child pointer may or may not point to a separate doubly lin 2020-07-11 #leetcode #java #dfs #linked list
[LeetCode] 763. Partition Labels You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part. Note that the partition is done so that after concatenating al 2020-07-10 #leetcode #two pointer #hashmap #java #greedy #string