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. …
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”, “1+1i” …
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 …
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 …
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: …
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. …