Vellore Institute of Technology 2025
My Stats
EXP gained
5778
Level
6 (Specialist)
Community stats
Discussions
0
0
Know more
101
Total problems solved
75
Easy
24
Moderate
2
Hard
0
Ninja

Current streak:

0 days

Longest streak:

14 days

Less

More

Achievements
1
Ronin
Topics
Arrays
1
Samurai
Topics
Discussions
Best solution in cpp O(N) , O(1) using two pointer
Interview problems
``````        sort(nums.begin() , nums.end());
int i=0;
int j= nums.size()-1;

while(i!=j){
int sum = nums[i] + nums[j];
if(sum==target){
return "YES";
// break;
}
else{

sum < target ? i++ : j--;
}
}
return "NO";``````
yaswanth_Mitta
Published On 19-Aug-2023
38 views
0 replies
error while submission
Interview problems

Though the code is correct and test cases are passing while submitting the code it shows error . Is it happening with everyone?

My code:

``````void bubbleSort(int arr[], int n)
{
//write your code here
if(n==0) return;

for(int i=0;i<n-1; i++){
if(arr[i] > arr[i+1]){
swap(arr[i] , arr[i+1]);
}
}

bubbleSort(arr , n-1);
}``````
yaswanth_Mitta
Published On 08-Aug-2023
115 views
2 replies
partiaally correct?
Interview problems

int sumFirstN(int n) {

// Write Your Code Here

if(n==1){

return 1;

}

return n + sumFirstN(n-1);

}

just wanted to know why its partially correct?

yaswanth_Mitta
Published On 07-Aug-2023
160 views
3 replies