Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
给你一个二叉树的根节点root, 检查它是否轴对称。 示例1: 输入:root = [1,2,2,3,4,4,3]输出:true 示例2: 输入:root = [1,2,2,null,3,null,3]输出:false 提示: 树中节点数目在范围[1, 1000]内 -100 <= Node.val <= 100 进阶:你可以运用递归和迭代两种方法解决这个问题吗?
53. 最大子数组和 - 给你一个整数数组 nums ,请你找出一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。 子数组 是数组中的一个连续部分。 示例 1: 输入:nums = [-2,1,-3,4,-1,2,1,-5,4] 输出:6 解释:连续子数组 [4,-1,2,1] 的和最大,为
实现pow(x,n),即计算x的整数n次幂函数(即,xn)。 示例1: 输入:x = 2.00000, n = 10输出:1024.00000 示例2: 输入:x = 2.10000, n = 3输出:9.26100 示例3: 输入:x = 2.00000, n = -2输出:0.25000解释:2-2= 1/22= 1/4 = 0.25 提示: ...
testHead=testHead.next; } }if(!valid){break; }if(pre ==null){ pre=testHead; ret=pre; }else{ pre.next=testHead; } ListNode oldPre=current; ListNode next=current.next; current.next=testHead.next; pre=current; current=next;for(inti = 1; i < k; ++i){ ...
class Solution { public: int myAtoi(string str) { int index = -1; int result = 0; int base = 10; int ssize = str.size(); bool negtive = false; whil...
365 Water and Jug Problem Algorithms Medium 363 Max Sum of Rectangle No Larger Than K Algorithms Medium 357 Count Numbers with Unique Digits Algorithms Medium 355 Design Twitter design-twitter Algorithms Hard 354 Russian Doll Envelopes Algorithms Hard 352 Data Stream as Disjoint Intervals Algorithms Ha...
maybe because it looked like one and proved exactly to be one. It's among the last few problem I solved on LeetCode. It took me hours to think it through and another 1 or 2 to write an acceptable version of code. A rough idea would be a 1~n counting. This counting is no easier...
(,, ): HDU 1542 Atlantis update: query: HDU 1828 Picture update: query: Title Solution Difficulty Time Space O(n log 218. The Skyline Problem Go Hard O(n) n) 307. Range Sum Query - Go Hard O(1) O(n) Mutable 315. Count of Smaller O(n log Go Hard O(n) Numbers After Self ...
website:https://leetcode.com/problemset/all/ username/password: yanyan314/ 314@leetcode leetcode刷题总结博客:https://blog.csdn.net/nettee?type=blog&year=2020&month=03answers:https://www.jiuzhang.cn/solution/intersection-of-two-arrays-ii/ ...