DSA

Data Structure & Algorithm

Best Time to Buy and Sell Stock

You are given an integer array prices where prices[i] represents the price of a stock on the iᵗʰ day. You want to maximize your profit by choosing one day to buy the stock and a different day in the future to sell it. Return the maximum profit you can achieve.If you cannot make any profit,

Reverse Array

Given an integer array nums, your task is to rotate it to the right by k positions, where k is a non-negative integer. Example Solution 🧠 Key Learnings From the Rotate Array problem, I learned how to use the reverse technique with two pointers to perform array rotation efficiently in-place. This approach deepened my understanding

Scroll to Top