https://www.interviewbit.com/old/problems/is-rectangle/ int Solution::solve(int A, int B, int C, int D) { if (((A==B)&&(C==D))||((A==C)&&(B==D))||((A==D)&&(B==C))){ return 1; }else{ return 0; } }
Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1] . Input: nums = [5,7,7,8,8,10], target = 8 Output: [3,4] class Solution { public: vector<int> searchRange(vector<int>& v, int b) { int n=v.size(); int low=0; int high=n-1; int mid; vector<int> ans(2); ans[0]=-1; ans[1]=-1; while(low<=high) { mid=low+(high-low)/2; ...
Comments
Post a Comment