题目描述:操作给定的二叉树,将其变换为源二叉树的镜像。import Foundation class For19Solution { func mirrorTreeNode(_ root: TreeNode?) -> TreeNode? { if root == nil || (root?.left == nil && roo...
题目描述:输入两颗二叉树A,B,判断B是不是A的子结构。import Foundation class For18Solution { func isSubTreeNode(_ pRoot: TreeNode?,_ qRoot: TreeNode?) -> Bool { var res = false if ...
题目描述:import Foundation class For17Solution { func mergeListNode(_ head1: ListNode?,_ head2: ListNode?) -> ListNode? { if head1 == nil { return head2 } ...
题目描述:链表中倒数第 K 个结点。import Foundation class For15Solution { func reversedK(_ head: ListNode?,_ k: Int) -> ListNode? { guard head != nil && k != 0 else { r...