Leetcode Note: Go - Longest Uncommon Subsequence I

Longest Uncommon Subsequence I - LeetCode
https://leetcode.com/problems/longest-uncommon-subsequence-i/

  • Go 言語で取り組んだメモ

所感

  • string 変数 a, b の longest uncommon subsequence を求めて int で return する
  • longest uncommon subsequence は共通してない部分文字列のことお

回答

Longest Uncommon Subsequence I - LeetCode
https://leetcode.com/problems/longest-uncommon-subsequence-i/solution/

1 Line Solution - JS/TS/C++/Python/Java/PHP/Go - LeetCode Discuss
https://leetcode.com/problems/longest-uncommon-subsequence-i/discuss/2015018/1-Line-Solution-JSTSC%2B%2BPythonJavaPHPGo

func findLUSlength(a string, b string) int {
    if a == b {
        return -1
    }

    return int(math.Max(float64(len(a)), float64(len(b))))
}