ByteDance OA - 2 Oct (2)

ByteDance · Question · Posted Oct 2021

Given integers n and k, decompose n into a sum of at least 2 positive integers where each integer > k, and maximize the product of those integers. Return the maximum product you can get. If n cannot be decomposed as required, return -1. Either way, please return it as a string.  For example, if n is 8, •k= 2:8 = 3 + 3 + 2:3*3*2 = 18 •k= 3:8 = 4 + 4:4 * 4 = 16 cannot be ...

The full answer & interview discussion are available to premium members.

Log in Create a free account