JinFei's Blog

Thinking will not overcome fear but action will.

[LeetCode]36. Valid Sudoku

检查数独是否有效

题目描述 Determine if a 9x9 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. E...

[LeetCode]1339. Maximum Product of Splitted Binary Tree

二叉树左右子树之积

题目描述 Given the root of a binary tree, split the binary tree into two subtrees by removing one edge such that the product of the sums of the subtrees is maximized. Return the maximum product of...

[LeetCode]2. Add Two Numbers

链表相加

题目描述 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers a...

[LeetCode]15. 3Sum

2Sum的变形,双指针的应用

题目描述 Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Example1: Given array...

[LeetCode]91. Decode Ways

dp,字母的组合

题目描述 A message containing letters from A-Z is being encoded to numbers using the following mapping: ‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Given a non-empty string containing...

[LeetCode]160. Intersection of Two Linked Lists

链表的第一个交点

题目描述 Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: https://assets.leetcode.com/uploads/2018/12/1...

[LeetCode]1448. Count Good Nodes in Binary Tree

查找与根路径较大的值

题目描述 Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X. Return the number of good nodes in the binary tr...

[LeetCode]Range Sum Query - Immutable

直方图思想

题目描述 Given an integer array nums, handle multiple queries of the following type: Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. Impl...

[LeetCode]283. Move Zeroes

移动0

题目描述 Given an integer array nums, move all 0’s to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the ...

[LeetCode]1. Two Sum

模拟

题目描述 Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, a...