DEV Community

vishal.codes
vishal.codes

Posted on

Day 35/366

🚀 Today's Learning:

🌟 DSA

  • Longest increasing subsequence
  • Selecting stock

🌟 Dev

  • Styled components library

🔍 Some Key Highlights:

DSA

To find the longest increasing subsequence, the algorithm iterates through each element in the sequence, keeping track of the length of the longest increasing subsequence ending at that element. It does this by comparing the current element with all previous elements, updating the length if the current element is greater and has a longer subsequence. The overall longest increasing subsequence length is the maximum of these lengths across all elements.

For selecting stocks, the algorithm analyzes each stock's price and its potential for profit. It iterates through the prices, keeping track of the minimum price seen so far and the maximum profit that can be made by buying at that minimum price and selling at the current price. It updates these values as it progresses through the prices, ultimately returning the maximum profit possible.

DEV

Styled Components is a library for styling React components with JavaScript and CSS. It allows developers to write CSS in JavaScript files using tagged template literals. This approach enables scoped styles, where styles are encapsulated within the component, preventing them from affecting other components. Styled Components simplifies the process of creating reusable and maintainable UI components by allowing developers to define styles directly within their component code. Additionally, it supports dynamic styling based on props and theming, making it a powerful tool for building responsive and customizable user interfaces in React applications.

#100daysofcode

Top comments (0)