RV College of Engineering 2025
C++ - Default language
My Stats
EXP gained
8450
Level
6 (Specialist)
Community stats
Discussions
0
0
Know more
329
Total problems solved
305
Easy
24
Moderate
0
Hard
0
Ninja

Current streak:

0 days

Longest streak:

9 days

Less

More

Achievements
2
Ronin
Topics
Arrays
Sorting
1
Samurai
Guided path
Basics of C++
2
Sensei
Guided path
Pointers
Flutter
Discussions
STRIVER's WAY
Interview problems

#include <bits/stdc++.h>

int countDigit(long long x) {

int cnt = (int)(log10(x)+1);

return cnt;

}

aamir01
Published On 04-Jun-2023
142 views
0 replies
Easy
Interview problems

#include <bits/stdc++.h>  void solve(stack<int>&inputStack, int count, int size) {    //base case    if(count == size/2) {        inputStack.pop();        return ;    }        int num = inputStack.top();    inputStack.pop();     //RECURSIVE CALL    solve(inputStack, count+1, size);        inputStack.push(num);     }

void deleteMiddle(stack<int>&inputStack, int N){   int count = 0;    solve(inputStack, count, N);    }

aamir01
Published On 18-May-2023
118 views
0 replies
BEST SOLUTION
Interview problems

class ComplexNumbers {

// Complete this class

int Real;

int Imag;

public:

ComplexNumbers(int r, int i)

{

Real = r;

Imag = i;

}

void plus(ComplexNumbers const &c )

{

Real = Real + c.Real;

Imag = Imag + c.Imag;

}

void multiply(ComplexNumbers &c)

{

int temp1, temp2;

temp1 = Real*c.Real - Imag*c.Imag;

temp2 = Real*c.Imag + Imag*c.Real;

Real = temp1;

Imag = temp2;

}

void print()

{

cout<<Real<<" + "<<"i"<<Imag;

}

};

aamir01
Published On 01-Feb-2023
239 views
0 replies
BEST SOLUTIONS
Interview problems

int solve(int *arr, int s, int e, int k) {    if(s>e)    return -1;        int mid = s+ (e-s)/2;    if(arr[mid] == k)    {        return mid;            }    if(arr[mid] < k)    {        return solve(arr, mid+1, e, k);            }    else     {        return solve(arr, s, mid-1, k);    } }

int binarySearch(int *input, int n, int val) {    //Write your code here    int ans = solve(input, 0, n-1, val); }

aamir01
Published On 16-Jan-2023
58 views
0 replies
BEST CODE
Interview problems

#include <bits/stdc++.h>  #include <iostream>

using namespace std;

//Write your totalPrime function here int totalPrime(int a, int b) {    int i,j,flag,count=0;    for(i=a; i<=b; i++)     {          flag = 0;          for(j=2; j <= i/2; j++)          {               if(i%j==0)               {                    flag=1;                    break;               }          }          if(flag==0 && i>=2)          {                            count++;          }    }    return count; }

int main() {    int S, E;    cin >> S >> E;    cout << totalPrime(S, E);    return 0; }

aamir01
Published On 12-Jan-2023
150 views
0 replies
What's wrong in this?
Interview problems

#include <bits/stdc++.h>  #include <iostream> using namespace std;

int main() {   int basicSalary;    char ch;    cin>>basicSalary>>ch;    float hra, da, pf;    int allow;    hra = 0.2*basicSalary;    da = 0.5*basicSalary;    pf = 0.11*basicSalary;        int totalSalary = 0;        if(ch == 'A')    {        allow = 1700;    }    else if (ch == 'B')    {        allow = 1500;    }    else    {        allow = 1300;     }    totalSalary = totalSalary + basicSalary+ hra + da + allow - pf;   cout<<(int)round(totalSalary)<<endl;

return 0; }

aamir01
Published On 10-Jan-2023
31 views
0 replies
Approach
Interview problems

Step 1: Store the elements of array2 in array1.

Step 2: Sort the elements of array1.

Step 3: Return the array1 elements.

aamir01
Published On 29-Dec-2022
147 views
1 replies