indian institute of information technology guwahati
Indian Institute of Information Technology, IIIT Guwahati 2026
C++ - Default language
My Stats
EXP gained
1204
Level
5 (Champion)
Community stats
Discussions
0
4
Know more
28
Total problems solved
27
Easy
1
Moderate
0
Hard
0
Ninja

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;

}

Published On 27-Sep-2023
34 views
0 replies
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;

}

Published On 27-Sep-2023
85 views
0 replies
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]);

}

}

Published On 12-Aug-2023
91 views
0 replies
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;

}

Published On 07-Aug-2023
77 views
0 replies
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;

}

Published On 07-Aug-2023
44 views
0 replies
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;

}