Day 3 of DSA Daily: Steady Progress

Today was a bit busy for me, but I still made sure to keep my streak going, I managed to solve a problem on LeetCode. You can find the problem here: Power of Two.

Though it might not seem like a lot, but I spent 5-10 minutes and tried brute force method on pen and paper and solved it by myself.

Here's the code to it.

class Solution {
public:
    bool isPowerOfTwo(int n) {
        for(int i = 0;i<=30;i++){
            int ans = pow(2,i);
            if(ans == n){
                return true;
            }
        }
        return false;
    }
};

Tomorrow, I'm wish to make more progress. My goal is to complete the next video from Babar's DSA Playlist. The upcoming video will cover Switch statements and functions.

Stay tuned for more updates,

Best regards,
Jay Chavan