摘要:
Sum of Left Leaves Given the root of a binary tree, return the sum of all left leaves. A leaf is a node with no children. A left leaf is a leaf that i 阅读全文
posted @ 2022-10-23 22:37
iyiluo
阅读(18)
评论(0)
推荐(0)
摘要:
Assign Cookies Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each 阅读全文
posted @ 2022-10-23 22:18
iyiluo
阅读(21)
评论(0)
推荐(0)
摘要:
Fizz Buzz Given an integer n, return a string array answer (1-indexed) where: answer[i] == "FizzBuzz" if i is divisible by 3 and 5. answer[i] == "Fizz 阅读全文
posted @ 2022-10-23 21:41
iyiluo
阅读(20)
评论(0)
推荐(0)
摘要:
Valid Anagram Given two strings s and t, return true if t is an anagram of s, and false otherwise. An Anagram is a word or phrase formed by rearrangin 阅读全文
posted @ 2022-10-23 12:49
iyiluo
阅读(26)
评论(0)
推荐(0)
摘要:
Remove Linked List Elements Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and 阅读全文
posted @ 2022-10-23 12:15
iyiluo
阅读(34)
评论(0)
推荐(0)
摘要:
Move Zeroes 思路一: 用 left 指针标记求解数组最大下标 + 1,初始化的时候是 0,随着往右遍历,left 会一步步扩大。最后把 left 右边的数都置为 0。 这题的关键在于 left 永远指向求解数组最大下标 + 1 public void moveZeroes(int[] n 阅读全文
posted @ 2022-10-23 09:08
iyiluo
阅读(15)
评论(0)
推荐(0)
摘要:
Power Of Two 思路一: 观察 2 的 n 次方的二进制,都只有一位 1 bit,遍历即可 public boolean isPowerOfTwo(int n) { if (n <= 0) return false; int count = 0; for (int i = 0; i < 3 阅读全文
posted @ 2022-10-23 08:35
iyiluo
阅读(22)
评论(0)
推荐(0)

浙公网安备 33010602011771号