随笔分类 -  leetcode

58-II.左旋字符串
摘要:字符串的左旋转操作是把字符串前面的若干个字符转移到字符串的尾部。请定义一个函数实现字符串左旋转操作的功能。比如,输入字符串"abcdefg"和数字2,该函数将返回左旋转两位得到的结果"cdefgab"。 示例 1: 输入: s = "abcdefg", k = 2输出: "cdefgab" 示例 2 阅读全文
posted @ 2020-10-03 20:04 Taurus20000519 阅读(76) 评论(0) 推荐(0)
235.二叉搜索树的最近公共祖先
摘要:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2020-09-27 09:49 Taurus20000519 阅读(96) 评论(0) 推荐(0)