G onsite题目# JobHunting - 待字闺中
s*i
1 楼
Given a list of words, find two strings S & T such that:
a. S & T have no common character
b. S.length() * T.length() is maximized
Follow up: how to optimize and speed up your algorithm
前面有讨论用一个int来决定S和T是否有common character。但S.length() * T.length
() 还需要找出n^2个组合,这个有办法降低吗?
a. S & T have no common character
b. S.length() * T.length() is maximized
Follow up: how to optimize and speed up your algorithm
前面有讨论用一个int来决定S和T是否有common character。但S.length() * T.length
() 还需要找出n^2个组合,这个有办法降低吗?