题解 | #名字串生成II#

名字串生成II

https://www.nowcoder.com/practice/a90b0c33344e4b8488fe0b376de3205d

package main

import "strings"

/**
 * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
 *
 *
 * @param str1 string字符串
 * @param str2 string字符串
 * @return string字符串
 */
func lcmOfStrings( str1 string ,  str2 string ) string {
    // write code here
    if strings.Contains(str1, str2){
        return str1
    }else if strings.Contains(str2, str1){
        return str2
    }else{
        return ""
    }
    
}

全部评论

相关推荐

有担当的灰太狼又在摸鱼:零帧起手查看图片
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务