ARTS #154 Algorithm 本周选择的算法题是:Permutations II。 规则 Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. Example 1: Input: nums = [1,1,... 2022-05-154 min read
ARTS #153 Algorithm 本周选择的算法题是:132 Pattern。 规则 Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nu... 2022-05-084 min read
ARTS #152 Algorithm 本周选择的算法题是:Design Underground System。 规则 An underground railway system is keeping track of customer travel times between different stations. They are using this data to calculate the av... 2022-04-3012 min read
ARTS #151 Algorithm 本周选择的算法题是:Recover Binary Search Tree。 规则 You are given the root of a binary search tree (BST), where the values of exactly two nodes of the tree were swapped by mistake. Recover the tr... 2022-04-243 min read
ARTS #150 Algorithm 本周选择的算法题是:Convert BST to Greater Tree。 规则 Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original ... 2022-04-166 min read
ARTS #149 Algorithm 本周选择的算法题是:Swapping Nodes in a Linked List。 规则 You are given the head of a linked list, and an integer k. Return the head of the linked list after swapping the values of the kth node f... 2022-04-104 min read
ARTS #148 Algorithm 本周选择的算法题是:Next Permutation。 规则 A permutation of an array of integers is an arrangement of its members into a sequence or linear order. For example, for arr = [1,2,3], the following... 2022-04-044 min read
ARTS #147 Algorithm 本周选择的算法题是:Two City Scheduling。 规则 A company is planning to interview 2n people. Given the array costs where costs[i] = [aCosti, bCosti], the cost of flying the ith person to city a is ... 2022-03-266 min read
ARTS #146 Algorithm 本周选择的算法题是:Validate Stack Sequences。 规则 Given two integer arrays pushed and popped each with distinct values, return true if this could have been the result of a sequence of push and po... 2022-03-1910 min read
ARTS #145 Algorithm 本周选择的算法题是: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 contains ... 2022-03-125 min read