原创 LeetCode 670. Maximum Swap 字符串有坑
Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maxim
原创 LeetCode 465. Optimal Account Balancing 互相結賬 回溯 組合
A group of friends went on holiday and sometimes lent each other money. For example, Alice paid for Bill's lunch for $1
原创 LeetCode 311. Sparse Matrix Multiplication
Given two sparse matrices A and B, return the result of AB. You may assume that A's column number is equal to B's row n
原创 LeetCode 410. Split Array Largest Sum DP 二分
Given an array which consists of non-negative integers and an integer m, you can split the array into m non-empty conti
原创 LeetCode 1352. Product of the Last K Numbers 前綴法處理特殊值
Implement the class ProductOfNumbers that supports two methods: 1. add(int num) Adds the number num to the back of the
原创 LeetCode 249. Group Shifted Strings
Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "s
原创 LeetCode 444. Sequence Reconstruction Sequence不連續
Check whether the original sequence org can be uniquely reconstructed from the sequences in seqs. The org sequence is a
原创 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
原创 LeetCode 1172. Dinner Plate Stacks 設計中間彈棧
You have an infinite number of stacks arranged in a row and numbered (left to right) from 0, each of the stacks has the
原创 LeetCode 269. Alien Dictionary 拓撲排序
There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You r
原创 LeetCode 1088. Confusing Number II 回溯
We can rotate digits by 180 degrees to form new digits. When 0, 1, 6, 8, 9 are rotated 180 degrees, they become 0, 1, 9
原创 LeetCode 399. Evaluate Division 有向並查集(被指向的作根) 拓撲排序
Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number
原创 LeetCode 489. Robot Room Cleaner 掃地機器人
Given a robot cleaner in a room modeled as a grid. Each cell in the grid can be empty or blocked. The robot cleaner wit
原创 LeetCode 1293. Shortest Path in a Grid with Obstacles Elimination 下一層坑
Given a m * n grid, where each cell is either 0 (empty) or 1 (obstacle). In one step, you can move up, down, left or ri
原创 LeetCode 1110. Delete Nodes And Return Forest
Given the root of a binary tree, each node in the tree has a distinct value. After deleting all nodes with a value in t