Update appNew update is available. Click here to update.
About
Dr. Shakuntala Misra National Rehabilitation University 2024
My Stats
EXP gained
yellow-spark
290
Level
3 (Seasoned)
Community stats
Discussions
0
Upvotes
0
Know more
10
Total problems solved
9
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:

1 day

Longest streak:

3 days

Less

More

Discussions
loop solution
General discussion

#include <bits/stdc++.h> 

int findMSB(int n){

    int ans=1;

    for(int i=1; i<=n; i++){

        if(pow(2,i)<=n){

            ans=pow(2,i);

            continue;

        }

        else{

            break;

        }

    }

    return ans;

}

profile
Niliya
Published On 09-Nov-2023
24 views
0 replies
0 upvotes
loop solution
General discussion

#include <bits/stdc++.h> 

int findMSB(int n){

    int ans=1;

    for(int i=1; i<=n; i++){

        if(pow(2,i)<=n){

            ans=pow(2,i);

            continue;

        }

        else{

            break;

        }

    }

    return ans;

}

profile
Niliya
Published On 09-Nov-2023
24 views
0 replies
0 upvotes