🚀 Today's Learning:
🌟 DSA
- Trapping Rainwater
- Merge Intervals
🌟 Dev
- React vs Next JS
🔍 Some Key Highlights:
DSA
In Trapping Rainwater, you iterate over each element in the array to calculate the amount of water that can be trapped at that specific position. For each element, you find the maximum height on its left and right sides. The trapped water at that position is the minimum of the maximum height on both sides minus the height of the current element. This process is repeated for every element in the array, accumulating the total trapped water.
Merge Intervals involves sorting the intervals based on their starting points. Then, you merge overlapping intervals by iterating through the sorted list. At each step, if the current interval overlaps with the previous one, you update the end point of the merged interval to be the maximum of the two end points. If there's no overlap, you add the current interval to the result list. This process continues until all intervals are processed, resulting in a list of merged non-overlapping intervals.
DEV
React.js is a JavaScript library for building user interfaces, primarily for single-page applications. It provides a component-based architecture where UIs are composed of reusable and encapsulated components. React.js allows developers to efficiently update and render UI components based on changes in application state, using a virtual DOM for performance optimization. It's commonly used in conjunction with other libraries and frameworks to build dynamic web applications.
Next.js, on the other hand, is a React framework for building server-rendered React applications. It adds capabilities to React.js, such as server-side rendering, static site generation, and API routes, among others. Next.js simplifies the setup and configuration of React applications by providing a batteries-included approach, offering features like file-based routing, automatic code splitting, and optimized production builds. It's well-suited for building scalable and SEO-friendly web applications with React.js.
#100daysofcode #1percentplusplus #coding #dsa
Top comments (0)