Tag: C++ algorithms
Given a list of integers, find the largest product of two distinct elements. Example 1 Input nums = Output 35 Explanation 35 is the largest product that can be …
Given a matrix with dimension NxN, rotate the matrix in place the 90 degrees clockwise and anti-clockwise. For example, original Matrix 3×3: vector<vector<int>> matrix({ {1, 2, 3}, {4, 5, …
You’re given a list of n integers arr. You must compute a list output such that, for each index i (between 0 and n-1, inclusive), output is equal to …
Balanced Split Given an array of integers (which may include repeated integers), determine if there’s a way to split the array into two subarrays A and B such that …
Given a sequence of n integers arr, determine the lexicographically smallest sequence which may be obtained from it after performing at most k element swaps, each involving a pair …