Cookie Consent by Free Privacy Policy Generator 📌 Day 24/366


✅ Day 24/366


💡 Newskategorie: Programmierung
🔗 Quelle: dev.to

🚀 Today's Learning:

🌟 DSA

Container With Most Water
Find the Factorial of a large number

🌟 Dev

useEffect and useState hooks

🔍 Some Key Highlights:

DSA

For the "Container With Most Water" problem, you're essentially finding the maximum area between two lines on a graph, where the lines represent the heights of bars and the distance between them represents the width of the container. You start with the widest container (the two outermost bars) and calculate the area. Then, you progressively narrow down the container by moving the shorter bar inward, as moving the longer bar wouldn't increase the area. You keep track of the maximum area encountered so far and return it once all possible containers are considered.

In the "Find the Factorial of a large number" problem, you're tasked with calculating the factorial of a large number efficiently. You typically use an array to represent large numbers, with each element of the array storing a digit. Then, you perform multiplication digit by digit, carrying over the overflow to the next digit, and so on until you've multiplied the entire number. This approach allows you to handle large factorials without running into overflow issues and efficiently compute the result.

DEV

In React, the useEffect hook allows you to perform side effects in function components. These side effects can include data fetching, subscriptions, or manually changing the DOM. You provide useEffect with a function that contains the code for your side effect. This function will be executed after every render, including the first one. You can also specify dependencies as a second argument to useEffect, which determines when the effect will re-run. If the dependencies change between renders, the effect will run again. This enables you to manage side effects and keep your components in sync with external data or state changes.

On the other hand, the useState hook is used for managing state in functional components. It allows you to add state to functional components without needing to convert them to class components. You call useState with the initial state value, and it returns an array containing the current state value and a function to update that value. When you call the update function returned by useState, React will re-render the component with the new state value. This enables you to create interactive components that respond to user actions or other events by updating their state and re-rendering.

#100daysofcode #1percentplusplus #coding #dsa

...

✅ Day 26/366


📈 19.37 Punkte

✅ Day 15/366


📈 19.37 Punkte

✅ Day 36/366


📈 19.37 Punkte

✅ Day 3/366


📈 19.37 Punkte

✅ Day 25/366


📈 19.37 Punkte

✅ Day 14/366


📈 19.37 Punkte

✅ Day 35/366


📈 19.37 Punkte

✅ Day 1/366


📈 19.37 Punkte

✅ Day 24/366


📈 19.37 Punkte

✅ Day 13/366


📈 19.37 Punkte

✅ Day 34/366


📈 19.37 Punkte

✅ Day 23/366


📈 19.37 Punkte

✅ Day 12/366


📈 19.37 Punkte

✅ Day 32/366


📈 19.37 Punkte

✅ Day 22/366


📈 19.37 Punkte

✅ Day 43/366


📈 19.37 Punkte

✅ Day 11/366


📈 19.37 Punkte

✅ Day 32/366


📈 19.37 Punkte

✅ Day 21/366


📈 19.37 Punkte

✅ Day 42/366


📈 19.37 Punkte

✅ Day 10/366


📈 19.37 Punkte

✅ Day 31/366


📈 19.37 Punkte

✅ Day 20/366


📈 19.37 Punkte

✅ Day 41/366


📈 19.37 Punkte

✅ Day 9/366


📈 19.37 Punkte

✅ Day 30/366


📈 19.37 Punkte

✅ Day 19/366


📈 19.37 Punkte

✅ Day 40/366


📈 19.37 Punkte

✅ Day 7/366


📈 19.37 Punkte

✅ Day 29/366


📈 19.37 Punkte

✅ Day 18/366


📈 19.37 Punkte

✅ Day 39/366


📈 19.37 Punkte

✅ Day 6/366


📈 19.37 Punkte

✅ Day 28/366


📈 19.37 Punkte

✅ Day 17/366


📈 19.37 Punkte











matomo

Datei nicht gefunden!