ARTS #160 Algorithm 本周选择的算法题是:Construct Target Array With Multiple Sums。 规则 You are given an array target of n integers. From a starting array arr consisting of n 1’s, you may perform the following proced...
ARTS #159 Algorithm 本周选择的算法题是:Number of 1 Bits。 规则 Write a function that takes an unsigned integer and returns the number of ‘1’ bits it has (also known as the Hamming weight). Note: Note that in som...
ARTS #158 Algorithm 本周选择的算法题是:Remove Palindromic Subsequences。 规则 You are given a string s consisting only of letters 'a' and 'b'. In a single step you can remove one palindromic subsequence from s. Retu...
ARTS #157 Algorithm 本周选择的算法题是:transpose-matrix。 规则 Given a 2D integer array matrix, return the transpose of matrix. The transpose of a matrix is the matrix flipped over its main diagonal, switching the m...
ARTS #156 Algorithm 本周选择的算法题是:Number of Steps to Reduce a Number to Zero。 规则 Given an integer num, return the number of steps to reduce it to zero. In one step, if the current number is even, you have to...
ARTS #155 Algorithm 本周选择的算法题是:Coin Change。 规则 You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the few...
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,...
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...
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...
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...