首页 > 其他分享 >leetcode-521. 最长特殊序列 Ⅰ

leetcode-521. 最长特殊序列 Ⅰ

时间:2022-12-25 14:24:49浏览次数:54  
标签:return int max 521 func 序列 leetcode

521. 最长特殊序列 Ⅰ - 力扣(Leetcode)

脑筋急转弯

func findLUSlength(a string, b string) int {
    if a != b {
        return max(len(a), len(b))
    }

    return -1
}

func max(a,b int) int {
    if a > b {
        return a
    }

    return b
}

标签:return,int,max,521,func,序列,leetcode
From: https://www.cnblogs.com/wudanyang/p/17003982.html

相关文章

  • 图像处理程序的序列化和反序列化
       所谓序列化,就是讲内存数据保存为磁盘数据的过程,反序列化就是反过来理解。对于图像处理程序来说,最主要的变量是图片,然后还有相关的参数或运算结果。这里区分4个......
  • #yyds干货盘点# LeetCode程序员面试金典:首个共同祖先
    题目:设计并实现一个算法,找出二叉树中某两个节点的第一个共同祖先。不得将其他的节点存储在另外的数据结构中。注意:这不一定是二叉搜索树。例如,给定如下二叉树:root=[3,5,......
  • [LeetCode] 2389. Longest Subsequence With Limited Sum
    Youaregivenanintegerarray nums oflength n,andanintegerarray queries oflength m.Return anarray answer oflength m where answer[i] ist......
  • Unity内置JSON组件反序列化JSON数据
    Json数据如下:{"data":[{"id":141,"layoutLabel":"Sameer","hasCustomProb":1},{"id":......
  • leetcode-14最长公共前缀
    14.最长公共前缀编写一个函数来查找字符串数组中的最长公共前缀。如果不存在公共前缀,返回空字符串""。示例1:输入:strs=["flower","flow","flight"]输出:"fl"示例2:输入:s......
  • [LeetCode] 790. Domino and Tromino Tiling
    Youhavetwotypesoftiles:a 2x1 dominoshapeandatrominoshape.Youmayrotatetheseshapes.Givenanintegern,return thenumberofwaystotilea......
  • [LeetCode] 1754. Largest Merge Of Two Strings
    Youaregiventwostrings word1 and word2.Youwanttoconstructastring merge inthefollowingway:whileeither word1 or word2 arenon-empty,choos......
  • 你确定懂了Java中的序列化机制吗
    持续创作,加速成长!这是我参与「掘金日新计划·10月更文挑战」的第4天,点击查看活动详情概述java中的序列化可能大家像我一样都停留在实现Serializable接口上,对于它里面......
  • Leetcode61
    !!Giventhe head ofalinked list,rotatethelisttotherightby k places.!! # Definition for singly-linked list.# class ListNode(object):# ......
  • #yyds干货盘点# LeetCode程序员面试金典:合法二叉搜索树
    题目:实现一个函数,检查一棵二叉树是否为二叉搜索树。示例 1:输入:  2 /\ 1 3输出:true示例 2:输入:  5 /\ 1 4  /\  3 6输出:fa......