c# solution


  • 1
    N
    public class Solution {
        public int FindLUSlength(string a, string b) {
            if(a.Length!=b.Length) {
                return a.Length>b.Length?a.Length:b.Length;
            }
            else if(a.Equals(b)){
                return -1;
            }
            else{
                return a.Length;
            }
        }
    }
    

  • 0

    1 line is enough :p

    return a.Length>b.Length?a.Length:a==b?-1:b.Length;

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.