Update appNew update is available. Click here to update.
About
indian institute of information technology guwahati
Indian Institute of Information Technology, IIIT Guwahati 2026
C++ - Default language
My Stats
EXP gained
yellow-spark
1204
Level
5 (Champion)
Community stats
Discussions
0
Upvotes
4
Know more
28
Total problems solved
27
Easy
1
Moderate
0
Hard
0
Ninja
Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov Dec Dec

Current streak:

0 days

Longest streak:

3 days

Less

More

Discussions
usibg c++
Interview problems

int upperBound(vector<int> &arr, int n, int x) {

    // Write your code here

    

 

int low =0;

    int high=arr.size()-1;

    int ans=high+1;

  while(low<=high)

  {

      int mid=(low+high)/2;

      if(arr[mid]>x)

      {

          ans=mid;

          high=mid-1;

 

      }

      else {

          low=mid+1;

      }

 

  }

 

 return ans;

}

 

profile
vikash_yadav_07
Published On 27-Sep-2023
34 views
0 replies
0 upvotes
USING C++
Interview problems

int search(vector<int>& arr, int n, int k)

{

    // Write your code here.

    // Return the position of K in ARR else return -1.

  int low =0;

  int high=n-1;

  while(low<=high)

  {

 int mid=(low+high)/2;

 if(arr[mid]==k)

 return mid;

 if(arr[low]<=arr[mid])//left sorted

{

    if(arr[mid]>=k && arr[low]<=k)

    {

        high=mid-1;

 

    }

    else  {

        low=mid+1;

 

    }

 

}

else

{

    if(arr[mid]<=k&& k<=arr[high])

    {

        low=mid+1;

    }

    else 

    high=mid-1;

}

 

  }

  return -1;

}

 

profile
vikash_yadav_07
Published On 27-Sep-2023
85 views
0 replies
0 upvotes
simple solution using c++
Interview problems

void selectionSort(vector<int>&arr) {

    // Write your code here.

 for(int i=0;i<arr.size()-1;i++){

    int min=arr[i];

    for (int j = i + 1; j < arr.size(); j++) {

      if (min > arr[j])

        min = arr[j];

    }

   

      swap(min, arr[i]);

 }

}

profile
vikash_yadav_07
Published On 12-Aug-2023
91 views
0 replies
1 upvotes
c++
Interview problems

 void f(vector<int> &vec ,int n)

{

    if(n<1)

    return;

    vec.push_back(n);

    f(vec,n-1);

 

}

 

vector<int> printNos(int x) {

    // Write Your Code Here

    vector<int> ans;

    f(ans,x);

    return ans;

}

profile
vikash_yadav_07
Published On 07-Aug-2023
77 views
0 replies
1 upvotes
using c++
Interview problems

void f(vector<int> &vec ,int x,int start)

{

    if(x<start) return ;

    vec.push_back(start);

    f(vec,x,start+1);

}

 

vector<int> printNos(int x) {

    vector<int> ans;

    f(ans, x,1);

    return ans;

}

profile
vikash_yadav_07
Published On 07-Aug-2023
44 views
0 replies
1 upvotes
using c++
Interview problems

vector<int> printNos(int x) {

    vector<int> ans;

    if(x > 1)

        ans = printNos(x-1);

    ans.push_back(x);

    return ans; 

      

}

profile
vikash_yadav_07
Published On 07-Aug-2023
43 views
0 replies
1 upvotes