摘要:
题目 Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: s = "anagram", t = "nagaram" Output: true Exam 阅读全文
摘要:
题目 Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Given linked list head = [4,5,1,9], wh 阅读全文
摘要:
题目 Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 阅读全文
摘要:
题目 Invert a binary tree. 比如原来的树为 0 1 2 逆转后的树为 0 2 1 也就是把所有结点的左右结点互换 解法一 思路 递归 代码 解法二 思路 非递归,用树的层次遍历 代码 阅读全文
摘要:
题目 Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and t 阅读全文
摘要:
题目 Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the 阅读全文
摘要:
题目 Reverse a singly linked list. Example: Input: 1 2 3 4 5 NULL Output: 5 4 3 2 1 NULL Follow up: A linked list can be reversed either iteratively or 阅读全文