摘要:
struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; class Solution {public: vector<vec 阅读全文
摘要:
class Solution {public: vector<int>v1 = {-1,-1}; vector<int> searchRange(vector<int>& nums, int target) { if(nums.size()==0) { return v1; } v1[0] = fi 阅读全文
摘要:
class Solution { public: int peakIndexInMountainArray(vector<int>& arr) { int n = arr.size(); if(n==0) { return -1; } int left = 0; int right = n-1; w 阅读全文
摘要:
方法1(引入unordermap进行迭代判断): class Solution {public: int searchInsert(vector<int>& nums, int target) { if(nums.size()==0) { return -1; } unordered_map<int 阅读全文