Link: https://leetcode.com/problems/construct-the-longest-new-string/description/ ## 思路 z的个数有多少都不重要 如果xy数量一样 有多少用多少 否则数量小的那个可以都用掉 但数量多的只能多用一个 ## Code ```python= class Solution: def longestString(self, x: int, y: int, z: int) -> int: minVal = min(x, y) if x==y: return x*4+z*2 else: return minVal*4+2+z*2 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up