摘要: 参考:labuladong 递归反转链表的一部分 labubadong 如何k个一组反转链表 问题: 206.链表反转。 Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL 92.指定区间链表反转。 Note: 1 ≤ m 阅读全文
posted @ 2020-10-01 20:55 habibah_chang 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Binary Search Tree 二叉搜索树问题。 遍历框架: 1 void BST(TreeNode root, int target) { 2 if (root.val == target) 3 // 找到目标,做点什么 4 if (root.val < target) 5 BST(root 阅读全文
posted @ 2020-10-01 14:15 habibah_chang 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 问题: 判断一颗二叉树是否为二叉搜索树。 解法:Binary Tree(二叉树) 首先,了解 二叉搜索树BST的定义: A binary search tree is a rooted binary tree whose internal nodes each store a key greater 阅读全文
posted @ 2020-10-01 13:57 habibah_chang 阅读(160) 评论(0) 推荐(0) 编辑