题解 | #最长合成字符串#

最长合成字符串

http://www.nowcoder.com/practice/92a6faa7377f4c049a18154b24458d2a

//不考虑数组为空的情况
    public int getLongest(string[] str, int n)
    {
        // write code here
        if(n==1)
        {
            return (int)str[0].Length;
        }
        else
        {
            if(str[n-1].Length>getLongest(str,n-1))
                return (int)str[n-1].Length;
            else
                return getLongest(str,n-1);
        }
    }
全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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