https://helloacm.com/

转到作者网站

You probably have a list of files e.g. camera pictures that you want to re-number sequentially. For example, the photos are named using dates-and-time string. However, this is not idea, as many of us... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Balanced strings are those who have equal quantity of ‘L’ and ‘R’ characters. Given a balanced string s split it in the maximum amount of balanced strings. Return the maximum... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Given an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that the difference between adjacent elements in the... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Given two integers L and R, find the count of numbers in the range (inclusive) having a prime number of set bits in their binary representation. (Recall that the number of set bits an integer has is... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Modern Applications Development often requires testing APIs. If you don’t have backend API developed, you can create Mock API services using SoapUI. You probably can do the same thing using... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Given an array A, partition it into two (contiguous) subarrays left and right so that: Every element in left is less than or equal to every element in right. left and right are non-empty. left has... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Given two strings representing two complex numbers. You need to return a string representing their multiplication. Note i2 = -1 according to the definition. Example 1: Input: “1+1i”,... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

In Python, we can check if an array or list contains duplicate items using the following one-liner function. def contain_duplicates(list): return len(set(list)) != len(list) The idea is to convert... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

A Stepping Number is an integer such that all of its adjacent digits have an absolute difference of exactly 1. For example, 321 is a Stepping Number while 421 is not. Given two integers low and high,... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Given three integer arrays arr1, arr2 and arr3 sorted in strictly increasing order, return a sorted array of only the integers that appeared in all three arrays. Example 1: Input: arr1 = , arr2 = ,... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

You are given a string s that consists of lower case English letters and brackets. Reverse the strings in each pair of matching parentheses, starting from the innermost one. Your result should not... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

You have some apples, where arr is the weight of the i-th apple. You also have a basket that can carry up to 5000 units of weight. Return the maximum number of apples you can put in the basket.... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

You are given two strings s and t of the same length. You want to change s to t. Changing the i-th character of s to i-th character of t costs |s – t| that is, the absolute difference... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

You may see Python code like this: for i,v in enumerate(data): pass So, what does the enumerate() function do? The enumerate() in python takes a list as its first parameter, and optionally support... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Given an array of integers arr, write a function that returns true if and only if the number of occurrences of each value in the array is unique. Example 1: Input: arr = Output: true Explanation:... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Return the number of permutations of 1 to n so that prime numbers are at prime indices (1-indexed.) (Recall that an integer is prime if and only if it is greater than 1, and cannot be written as a... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Given an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements. Return a list of pairs in ascending order(with respect to pairs), each... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]

Given a graph represented by G(V, E) where V is the vertices and E represents the edges, we can do a Depth First Search Algorithm (DFS) on any node/vertex. The DFS will mark the current node visited... [[ This is a content summary only. Visit my website for full links, other content, and more! ]]