摘要:
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
阅读(23)
评论(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
阅读(27)
评论(0)
推荐(0)
摘要:
Move Zeroes 思路一: 用 left 指针标记求解数组最大下标 + 1,初始化的时候是 0,随着往右遍历,left 会一步步扩大。最后把 left 右边的数都置为 0。 这题的关键在于 left 永远指向求解数组最大下标 + 1 public void moveZeroes(int[] n 阅读全文
posted @ 2022-10-23 09:08
iyiluo
阅读(13)
评论(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
阅读(12)
评论(0)
推荐(0)