September 20, 2024
wp-header-logo-20.png
https://www.youtube.com/watch?v=WBzZCm46mFo


Lecture 13 of DSA Series – Buy and Sell Stock Problem & X raised to the Power N Problem Problem : Leetcode 121, Leetcode 50 …

20 thoughts on “Buy and Sell Stock Problem and Pow(X,N) Power exponential Problem – Leetcode | DSA Series

  1. 4:00
    I am saving this video for revision since I may forget the concept
    Lec completed ☑

    // x^n code in the simple format:

    // calculate x^n
    int main() {
    cout << "Enter x (float): "; double x; cin >> x;
    cout << "Enter N (int): "; int N; cin >> N;

    // code for power exponentiation : M1 [O(logn)]
    long absN = abs(N);
    double ans = 1;
    while(absN>0){
    if(absN%2==0){
    absN = absN/2;
    x = x*x;
    }
    else{
    absN = absN-1;
    ans = ans*x;
    }
    }
    if(N<0) ans = 1.0/ans;
    cout << "x^n : " << ans << endl; return 0; } Happy Coding

  2. Mam please give me only one reply i had done my post graduation in the Humanity stream and basic knowledge of computers not good spoken English can I be eligible to do full stack development course or not please reply me 🙏🙇

Leave a Reply

Your email address will not be published. Required fields are marked *