Loading

上一页 1 2 3 4 5 6 7 ··· 21 下一页
摘要: https://leetcode-cn.com/problems/open-the-lock/ 题目类型:BFS class Solution { //将s[j]向上拨动一次 String plusOne(String s, int j){ char[] ch = s.toCharArray(); 阅读全文
posted @ 2022-03-03 17:10 Zhbeii 阅读(92) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/shu-zhi-de-zheng-shu-ci-fang-lcof/ class Solution { public double myPow(double x, int n) { if(x == 0) return 0; long 阅读全文
posted @ 2022-02-28 16:08 Zhbeii 阅读(21) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/fei-bo-na-qi-shu-lie-lcof/ 使用动态规划 使用返回a,是因为,当使用b返回的时候需要考虑n == 0 的特例 class Solution { public int fib(int n) { int a = 阅读全文
posted @ 2022-02-28 14:22 Zhbeii 阅读(23) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/shu-zu-zhong-chu-xian-ci-shu-chao-guo-yi-ban-de-shu-zi-lcof/ 使用摩尔投票,使用两个变量。遍历数组 第一个记录当前遍历的数组的值,第二个记录当前遍历数字出现的次数 如果下一个 阅读全文
posted @ 2022-02-11 11:48 Zhbeii 阅读(24) 评论(0) 推荐(0)
摘要: class Solution { public boolean verifySequenceOfBST(int [] sequence) { Stack<Integer> stack = new Stack<>(); int root = Integer.MAX_VALUE; for(int i = 阅读全文
posted @ 2022-02-11 11:22 Zhbeii 阅读(23) 评论(0) 推荐(0)
摘要: https://www.nowcoder.com/practice/7d9a7b2d6b4241dbb5e5066d7549ca01?tpId=199&tags=&title=&difficulty=0&judgeStatus=0&rp=0 SELECT COUNT(gender) as male_ 阅读全文
posted @ 2022-02-09 10:26 Zhbeii 阅读(100) 评论(0) 推荐(0)
摘要: https://www.nowcoder.com/practice/389fc1c3d3be4479a154f63f495abff8?tpId=13&tags=&title=&difficulty=0&judgeStatus=0&rp=0 解题思路: 遍历异或,把那些出现两次的消掉。剩下的就是x,y 阅读全文
posted @ 2022-02-06 10:12 Zhbeii 阅读(39) 评论(0) 推荐(0)
摘要: ![image](https://img2022.cnblogs.com/blog/2138338/202202/2138338-20220205162548268-1039676023.png) 阅读全文
posted @ 2022-02-05 16:26 Zhbeii 阅读(22) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/shu-de-zi-jie-gou-lcof/ class Solution { public boolean isSubStructure(TreeNode A, TreeNode B) { return (A != null && 阅读全文
posted @ 2022-02-03 10:41 Zhbeii 阅读(33) 评论(0) 推荐(0)
摘要: https://leetcode-cn.com/problems/xuan-zhuan-shu-zu-de-zui-xiao-shu-zi-lcof/ 使用二分,左右指针,再mid和他们比。 https://www.acwing.com/solution/content/727/ class Sol 阅读全文
posted @ 2022-01-31 22:05 Zhbeii 阅读(23) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 21 下一页