teleren/devto huggingface dataset:
2285. Maximum Total Importance of Roads
Tags: php, leetcode, algorithms, programming
Published: 2024-06-28 16:42:31

2285\. Maximum Total Importance of Roads

Medium

You are given an integer `n` denoting the number of cities in a country. The cities are numbered from `0` to `n - 1`.

You are also given a 2D integer array roads where <code>roads[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> denotes that there exists a **bidirectional** road connecting cities <code>a<sub>i</sub></code> and <code>b<sub>i</sub></code>.

You need to assign each city with an integer value from `1` to `n`, where each value can only be used **once**. The **importance** of a road is then defined as the **sum** of the values of the two cities it connects.

Return _the **maximum total importance** of all roads possible after assigning the values optimally_.



**Example 1:**

![ex1drawio](https://assets.leetcode.com/uploads/2022/04/07/ex1drawio.png)

- **Input:** n = 5, roads = [[0,1],[1,2],[2,3],[0,2],[1,3],[2,4]]
- **Output:** 43
- **Explanation:** The figure above shows the country and the assigned values of [2,4,5,3,1].
  - The road (0,1) has an importance of 2 + 4 = 6.
  - The road (1,2) has an importance of 4 + 5 = 9.
  - The road (2,3) has an importance of 5 + 3 = 8.
  - The road (0,2) has an importance of 2 + 5 = 7.
  - The road (1,3) has an importance of 4 + 3 = 7.
  - The road (2,4) has an importance of 5 + 1 = 6.
  - The total importance of all roads is 6 + 9 + 8 + 7 + 7 + 6 = 43.
  - It can be shown that we cannot obtain a greater total importance than 43.

**Example 2:**

![ex2drawio](https://assets.leetcode.com/uploads/2022/04/07/ex2drawio.png)

- **Input:** n = 5, roads = [[0,3],[2,4],[1,3]]
- **Output:** 20
- **Explanation:** The figure above shows the country and the assigned values of [4,3,2,5,1].
    - The road (0,3) has an importance of 4 + 5 = 9.
    - The road (2,4) has an importance of 2 + 1 = 3.
    - The road (1,3) has an importance of 3 + 5 = 8.
    - The total importance of all roads is 9 + 3 + 8 = 20.
    - It can be shown that we cannot obtain a greater total importance than 20.



**Constraints:**


- <code>2 <= n <= 5 * 10<sup>4</sup></code>
- <code>1 <= roads.length <= 5 * 10<sup>4</sup></code>
- <code>roads[i].length == 2</code>
- <code>0 <= a<sub>i</sub>, b<sub>i</sub> <= n - 1</code>
- <code>a<sub>i</sub> != b<sub>i</sub></code>
- There are no duplicate roads.


**Solution:**

```
class Solution {

    /**
     * @param Integer $n
     * @param Integer[][] $roads
     * @return Integer
     */
    function maximumImportance($n, $roads) {
        $ans = 0;
        $count = array_fill(0, $n, 0);

        foreach ($roads as $road) {
            $u = $road[0];
            $v = $road[1];
            ++$count[$u];
            ++$count[$v];
        }

        sort($count);

        for ($i = 0; $i < $n; ++$i) {
            $ans += ($i + 1) * $count[$i];
        }

        return $ans;
    }
}
```



**Contact Links**

- **[LinkedIn](https://www.linkedin.com/in/arifulhaque/)**
- **[GitHub](https://github.com/mah-shamim)**
BUILD YOUR DREAMS WITH INDIAN STOCK MARKET
Tags: nifty, sensex
Published: 2024-06-28 16:40:27


## what is stock market

You can invest our money in various of company and as per your intrest you can buy and sell shares in market with a proper research and analysis. Other wise  they may loose money 

## how to buy stocks 
To buy and sell stocks we need a demat account and we need to take that demat account under SEBI register comapany only other wise we may face concequence ex:-FYERS,ZERODHA,ANGEL ONE, MOTHI OSWAL,

## HOW STOCK MARKET WORKS(** THE INTERNAL PROCESS**)

If you want to buy a share we cnat go directly to the company and can't ask for shares it is big process so to handle this we have exchanges name it's self exchange stocks they are NSE and BSE.

1. Consider a company like infosys they tieup with a banks and nse or bse they try to list some of there company shares in exchanges 
2. Now as i said before we need a demat account to buy those share here intermediates are exchanges(nse,bse) and brokers like angelone.

3.Those will be store in demat account in 2 working days.

## what is bull market and bear market

- In a bull market is liked by retail investors most but we need to be caution when will be end we dont know.

- In a bear market look like blood in dalal street.in that time even a good stocks will fall .And this is actually a good time to invest for future in sip.

## TYPES OF INVESTORS

1. FILLS(out of india like morgan stanly,bank of america)

they will control our market before 2020

2.DILLS (it is noting but our money like FD,bonds,and mutual funds**)
3.HIS  also called as big players (like harshath mahatha)
4.retail investors (small investors but now controlling market)
 

## conclusion :- You may feel regret to miss bitcoin but  your grand children will feel regret why my grandpa did't invest in "indian"stock market.
Transcend Receive Energy The Esoteric Path
Tags: esoteric, consciousness, meditation, alchemy
Published: 2024-06-28 16:28:58

# 🌌 Transcend &amp; Receive Energy: The Esoteric Path

The path to elevated consciousness and higher energies is paved with ancient wisdom, scientific insights, and meditative practices. From Carl Jungs theories to Nikola Tesla&#x27;s insights, there is a confluence of understanding that offers an in-depth look at the transcendental nature of our existence.

## 🌀 What is Collective Consciousness?

Collective consciousness refers to the shared beliefs, ideas, and moral attitudes which operate as a unifying force within society. Carl Jung expanded on this concept, illustrating layers such as the collective unconscious filled with archetypes, universal symbols, and primordial images.

## ⚡ Nikola Tesla&#x27;s Energy Perspective

Tesla believed in the interconnectivity of the universe through energy and frequencies. His ideas resonate with many esoteric beliefs, suggesting that by tapping into these universal energies, one could harness unprecedented powers and insights.

## 🌱 Accessing Higher Streams of Consciousness

Many ancient and modern practices aim to access higher streams of consciousness. Meditation, for instance, is a practice where one can focus their mind and eliminate the stream of thoughts to achieve greater clarity and connection to higher realms.

## 🌟 The Role of Vibration

Vibration or frequency is pivotal in accessing these higher states. By elevating one&#x27;s vibrational state through positive emotions, thoughts, diet, and environment, one aligns more closely with the universal energies that govern existence.

## 🍯 Alchemy &amp; The Magnum Opus

Alchemy is both a philosophical and protoscientific tradition aiming to transform. The Magnum Opus or &quot;Great Work&quot; is the path to enlightenment in alchemical terms, leading one through stages to create the Philosophers Stone.

## 📜 Hermes Trismegistus &amp; Hermeticism

The teachings of Hermes Trismegistus, especially the Hermetic Principles, provide foundational insights into the nature of the universe. These principles, like the Principle of Vibration and Principle of Correspondence, offer profound wisdom on the interconnectedness and rhythm of everything.

## 🌙 Esoteric Truths Across Cultures

Esoteric truths span across different cultures and ages. From the Kabbalah&#x27;s Tree of Life to the significance of Astrology, each offers a unique lens to perceive and interact with the universe&#x27;s energies.

## 🎓 Conclusion

Embarking on a journey to understand and elevate one&#x27;s consciousness and energy is both a personal and universal quest. By blending ancient wisdom with modern perspectives, one can find pathways to transcend and truly tap into the energies of the universe.

![Esoteric Pathways](/img/Esoteric.webp)
Elevate Your Web App Transforming Nextjs Project into a PWA
Tags: nextjs, pwa, webdev, tutorial
Published: 2024-06-28 16:23:51

## 🚀 Elevate Your Web App: Transforming Next.js Project into a PWA

## Introduction

In a realm where user experience significantly drives engagement and retention, Progressive Web Apps (PWAs) have emerged as a cornerstone for modern web development practices. By intertwining the benefits of web and mobile apps, PWAs offer a reliable, fast, and engaging user experience. Next.js, a React-based framework, shines in this aspect with its built-in capabilities to morph into a PWA with minimal hassle. This tutorial unfolds the process of transforming a Next.js project into a PWA, emphasizing the organization within the pages directory.

## Prerequisites 📋

Ensure you&#x27;re equipped with the following before embarking on this endeavor:

- A functional Next.js project set up on your machine 💻
- Familiarity with the pages directory structure in Next.js 📂
- A text editor or IDE of your choice 📝

## Getting Started with PWA Configuration ⚙️

### 1. Installing Necessary Packages

Kickstart the transformation by installing the requisite packages:

```bash
npm install next-pwa
```

### 2. Configuring next.config.js

Navigate to the root of your project and create or update the `next.config.js` file with the following configuration:

```javascript
const withPWA = require(&#x27;next-pwa&#x27;)

module.exports = withPWA({
  pwa: {
    dest: &#x27;public&#x27;,
  },
})
```

## Structuring Pages Directory 🗂

Organizing the pages directory is crucial for a streamlined development and maintenance process. Adhering to a logical structure enhances the clarity and efficiency of your project.

### 1. Page Components

Store your page components within respective directories under the pages directory. For instance, create a `home` directory for the home page components.

```plaintext
- pages
  - home
    - index.js
```

### 2. Service Worker

Create a custom service worker file, say `sw.js`, in the `public` directory. Populate it with the service worker logic conforming to your needs.

## Implementing PWA Features 🎉

With the groundwork laid, it&#x27;s time to implement the core PWA features like caching, push notifications, and offline access.

### 1. Caching

Leverage the service worker to implement caching strategies, ensuring a snappy user experience.

### 2. Offline Access

Configure the service worker to serve cached pages, enabling seamless offline access.

### 3. Push Notifications

Integrate push notifications to foster user engagement and provide timely updates.

## Testing Your PWA 🧪

Ensure to thoroughly test your PWA, validating its functionality across different scenarios and devices.

## Conclusion 🏁

Transitioning your Next.js project into a PWA not only elevates the user experience but also significantly boosts the performance and accessibility of your web app. The structured approach within the pages directory facilitates a well-organized, maintainable project setup. Embrace the prowess of PWA and Next.js to deliver a superior, modern web application. 🌟
TCP vs UDP Understanding the Differences
Tags: tcp, udp, networking, devops
Published: 2024-06-28 16:18:44

## What is TCP? 🔗

TCP stands for Transmission Control Protocol. It is a connection-oriented
protocol that provides a reliable way to send data over a network. TCP
guarantees that all data will be delivered in the correct order and that no data
will be lost. TCP is often used for applications that require a reliable
connection, such as web browsing and email.

## What is UDP? 📦

UDP stands for User Datagram Protocol. It is a connectionless protocol that
provides a faster way to send data over a network. UDP does not guarantee that
all data will be delivered or that it will be delivered in the correct order.
UDP is often used for applications that do not require a reliable connection,
such as streaming video and audio.

## Comparison of TCP and UDP 📊

| Feature             | TCP                 | UDP                    |
| ------------------- | ------------------- | ---------------------- |
| Connection-oriented | Yes                 | No                     |
| Data integrity      | Guaranteed          | Not guaranteed         |
| Data ordering       | Guaranteed          | Not guaranteed         |
| Flow control        | Yes                 | No                     |
| Error detection     | Yes                 | No                     |
| Retransmission      | Yes                 | No                     |
| Typical use cases   | Web browsing, email | Streaming video, audio |

## Which protocol should you use? 🤔

The best protocol to use depends on your specific needs. If you need a reliable
connection, then you should use TCP. If you need a faster connection and you
don&#x27;t need a reliable connection, then you should use UDP.

## Conclusion 🎉

TCP and UDP are both important protocols that are used to send data over a
network. TCP is a reliable protocol that guarantees that all data will be
delivered in the correct order. UDP is a faster protocol that does not guarantee
that all data will be delivered or that it will be delivered in the correct
order. The best protocol to use depends on your specific needs. Choose wisely!
🚀😄
FastAPI Beyond CRUD Part 15 - More Database And Schema Relationships
Tags: fastapi, python, backenddevelopment, api
Published: 2024-06-28 16:17:21

In this video, we enhance our SQLModel models by establishing additional database relationships within our application. We demonstrate how to efficiently retrieve data leveraging these relationships, with a specific focus on user reviews.
{%youtube HFsvl515eKM%}
Understanding RAID Levels
Tags: raid, storage, technology, devops
Published: 2024-06-28 16:13:36

# Understanding RAID Levels

RAID redundant array of independent disks is a technology that combines
multiple hard disk drives HDDs into a single logical unit. RAID provides
several benefits over using a single HDD, including improved performance,
increased capacity, and improved fault tolerance.

In this guide, we will be discussing the different RAID levels, their advantages
and disadvantages, and help you determine which RAID level is right for you.

## RAID 1 (Mirroring)

RAID 1 involves creating an exact copy of all data on two or more HDDs. This
provides the highest level of fault tolerance, as if one HDD fails, the data can
be recovered from the other HDD. However, RAID 1 has the lowest capacity
utilization, as all data is duplicated.

## RAID 5 (Striping with Parity)

RAID 5 divides data into blocks and stores each block on a different HDD. A
parity bit is also stored on each HDD, which can be used to reconstruct the data
if one HDD fails. RAID 5 provides good fault tolerance and capacity utilization,
but it is not as reliable as RAID 1.

## RAID 6 (Striping with Double Parity)

RAID 6 is similar to RAID 5, but it uses two parity bits per block. This
provides even better fault tolerance than RAID 5, but it also has a lower
capacity utilization.

## RAID 10 (Mirroring and Striping)

RAID 10 is a combination of RAID 1 and RAID 0. It involves creating an exact
copy of each block of data on two HDDs, and the blocks are then striped across
the HDDs. RAID 10 provides the highest level of fault tolerance and capacity
utilization of any RAID level, but it is also the most expensive.

## Choosing the Right RAID Level

The best RAID level for you will depend on your specific needs. If you need the
highest level of fault tolerance, RAID 1 is the best choice. If you need a good
balance of fault tolerance and capacity utilization, RAID 5 or RAID 6 is a good
choice. If you need the highest capacity utilization, RAID 10 is the best
choice.

Remember, no RAID level is 100% reliable. It is always important to have a
backup plan in place for critical data.

💻 Get started on improving the performance and reliability of your storage
today! 💻
🌟 Explore the extraordinary of BitPower Loop! 🌟
Tags: btc
Published: 2024-06-28 16:12:13

1️⃣ Smart contract guarantee: All transactions are automatically executed by smart contracts to ensure security and transparency.

2️⃣ Decentralized lending: No third-party intermediary is required, reducing costs and increasing autonomy. Users can borrow and lend directly through smart contracts.

3️⃣ Funding pool mechanism: Suppliers deposit assets into the fund pool, borrowers provide collateral and borrow the required assets from it, with higher liquidity.

4️⃣ Dynamic interest rate: The interest rate is adjusted in real time according to market supply and demand, transparent and open to ensure fairness.

5️⃣ Global service: Based on blockchain technology, users around the world can participate without geographical restrictions.

6️⃣ Fast approval: Smart contracts automatically review loan applications without manual intervention, efficient and convenient.

7️⃣ Secure asset collateral: Borrowers provide encrypted assets as collateral to reduce loan risks, provide higher loan amounts and lower interest rates.

🔗 Join BitPower Loop and experience safe, efficient and convenient decentralized lending services! #DeFi #Blockchain #Smart Contract #Decentralized Lending #BitPowerLoop

🔍 Learn more: https://bitpowerloop.com

💬 Have questions? Contact us! #Support #FinTech #Innovation

🌍 Let's embrace the future of decentralized finance together!
Understanding Two-Factor Authentication (2FA): How It Safeguards Your Accounts
Tags: cybersecurity, opensource, github, security
Published: 2024-06-28 16:07:13

In an era where online security threats loom large, safeguarding your digital accounts is paramount. Two-factor authentication (2FA) adds an essential layer of protection by requiring users to verify their identity in two distinct ways. Today, we unravel the concept of 2FA and showcase how VerifyVault seamlessly integrates this powerful security measure.

<u>**Understanding Two-Factor Authentication (2FA)**</u>
Two-factor authentication enhances account security by requiring users to provide two forms of identification:

- **Something You Know:** Typically, this is your password or PIN.
- **Something You Have:** This could be a physical device (like a smartphone) or a software token that generates a unique, time-sensitive code.

<u>**Step-by-Step Guide to How 2FA Works:**</u>

**Initial Login Attempt:**
- Imagine you're logging into your favorite application.
- You enter your username and password as usual.

**Verification Process:**
- Once your password is verified, the application prompts you for a second form of identification.
- This step varies based on the method you've chosen (e.g., OTP sent via SMS, generated by an authenticator app like VerifyVault).

**Entering the OTP:**
- Retrieve the OTP from your authenticator app or SMS.
- Enter the code within the time limit specified by the application.

**Access Granted:**
- Upon successful verification of the OTP, you gain access to your account.
- Even if someone obtains your password, they cannot access your account without the second factor (OTP).


<u>**Why Choose VerifyVault for 2FA?**</u>
VerifyVault streamlines the implementation of 2FA with intuitive setup and robust security measures. Our dedication to open-source development means VerifyVault empowers you to protect your digital assets effectively.

<u>**Implementing 2FA with VerifyVault:**</u>


**Download VerifyVault:**
- Head over to our GitHub repository and download the latest version, currently its Beta v0.2.2.

**Enable 2FA:**
- Open VerifyVault and navigate to "Add Account".
- Enter the name of the service and input the secret key.
- Once the account is added, click on it to view its information.

**Enhanced Security with VerifyVault:**
- Benefit from VerifyVault’s seamless integration of 2FA, ensuring your accounts are safeguarded against unauthorized access attempts.
- Stay updated with our latest releases and enhancements by following us on GitHub and contributing to our community.


Understanding the mechanics of 2FA empowers you to make informed decisions about securing your digital presence. With VerifyVault, implementing robust security measures like 2FA is straightforward and effective. Take charge of your online security today with VerifyVault and protect what matters most.
BitPower: A revolutionary force that reshapes finance
Published: 2024-06-28 16:06:02


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b4ng06b2q9c9893fk7y1.png)
BitPower: A revolutionary force that reshapes finance
In an infinite digital world, BitPower shines like a star. It is not just a platform, but also a revolutionary force that re-empowers the public with financial power. BitPower's advantages are like a sharp sword that breaks the shackles of traditional finance, allowing everyone to find their own path to wealth in this vast territory.

First of all, BitPower's decentralized nature is amazing. On this platform, there are no bosses, no managers, and even no individuals who can modify the rules. Once deployed, BitPower's smart contracts are as indestructible as rocks. All rules and transactions are open and transparent, and no one can tamper with them. This design ensures the security of users' funds and the fairness of transactions.

Secondly, BitPower's global service capabilities are amazing. No matter where you are, as long as you have an Internet connection, you can participate. All transactions on the platform are conducted peer-to-peer, without middlemen and without high fees. This global barrier-free service makes financial services truly borderless and barrier-free.

Furthermore, BitPower's high-yield return mechanism is fascinating. Whether it is recurring income or referral rewards, users can find a satisfactory way of income on this platform. Each recurring order will be automatically returned to the user's wallet after expiration, so that the funds are always under the control of the user. Such an income mechanism not only allows users to obtain considerable returns, but also improves the liquidity and efficiency of funds.

In addition, BitPower's smart contract technology is also a highlight. All operations such as lending, deposits, and interest calculations are automatically executed by smart contracts. This not only improves the efficiency of transactions, but also reduces the risks and errors of human operations. Every transaction data is recorded on the blockchain, which is open, transparent, and cannot be tampered with.

Finally, BitPower's community and partner system enable every participant to find their own value and belonging. By joining the BitPower community, everyone can contribute their wisdom and strength to jointly promote the development of the platform. BitPower's referral reward mechanism encourages users to invite more partners to join and share the dividends brought by this financial revolution.

In short, BitPower is redefining the future of finance with its unique advantages of decentralization, globalization, high returns, intelligence, and community. On this platform, everyone is their own master, and every transaction is an opportunity. Join BitPower, let us witness this financial revolution together and create unlimited possibilities for ourselves.

Simple, transparent, and free - this is BitPower's promise to you.